B3745 求大佬们看看哪里错了
  • 板块灌水区
  • 楼主Phyllis_
  • 当前回复11
  • 已保存回复11
  • 发布时间2023/7/11 15:39
  • 上次更新2023/11/3 10:31:32
查看原帖
B3745 求大佬们看看哪里错了
522982
Phyllis_楼主2023/7/11 15:39

题目链接:B3745 [语言月赛202304] 你的牌太多了

测试点信息(只对了第1,2个)

代码:

#include<iostream>
#include<cstdio>
#include<stack>
#include<cmath>
#include<vector>
#include<algorithm> 
using namespace std;
const int maxn = 110; 
int n,m,r;
int f1[maxn];
int p1[maxn];

int ans;
struct both{
	int f2,p2;
}b[maxn];
bool check(both x,both y){
	if(x.f2 == y.f2) return x.p2 < y.p2;
	return x.f2<y.f2;
}
int use[maxn];
int main()
{
	cin >> n >> m >> r;
	//ans = n;

	for(int i = 0; i < n; i++){
		cin >> f1[i];
	}
	for(int i = 0; i < n; i++){
		cin >> p1[i];
		
	}
	for(int i = 0; i < n; i++){
		cin >> b[i].f2;
	}
	for(int i = 0; i < n; i++){
		cin >> b[i].p2;
		
	}	
	sort(b,b+n,check);
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		x--;
		int f = f1[x],p = p1[x];
		for(int j = 0; j < n; j++){
			if(!use[j]){
				if(b[j].f2 == f && b[j].p2 > p){
					//ans--;
					use[j] = 1;
				}
			}
		}
	}
	for(int i = 0; i < n; i++){
		if(use[i] == 0) ans++;
	}
	cout << ans;
    return 0;
}

求大佬们帮忙看看,谢谢大佬!!!

2023/7/11 15:39
加载中...