社区讨论

B3745 求大佬们看看哪里错了

灌水区参与者 5已保存回复 11

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
11 条
当前快照
1 份
快照标识符
@lo29rig7
此快照首次捕获于
2023/10/23 10:19
2 年前
此快照最后确认于
2023/11/03 10:31
2 年前
查看原帖
代码:
CPP
#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;
}
求大佬们帮忙看看,谢谢大佬!!!

回复

11 条回复,欢迎继续交流。

正在加载回复...