【求助!!】70分 2,9,10WA
查看原帖
【求助!!】70分 2,9,10WA
666311
YangjinRun楼主2022/10/3 10:33
#include<bits/stdc++.h>
using namespace std;
int n,r,k;
struct node{
	long long num,s,w;
}a[100010];
bool cmp(node x,node y){
	if(x.s==y.s) return x.num<y.num;
	else return x.s>y.s;
}
int main(){
	cin>>n>>r>>k;
	n=n*2;
	for(int i=1;i<=n;i++){
		cin>>a[i].s;
		a[i].num=i;
	}
	for(int i=1;i<=n;i++) cin>>a[i].w;
	sort(a+1,a+n+1,cmp);
	while(r--){
		for(int i=1;i<=n-1;i+=2){
			if(a[i].w>a[i+1].w) a[i].s+=1;
			else a[i+1].s+=1;
		}
		sort(a+1,a+1+n,cmp);
	}
	cout<<a[k].num;
	return 0;
}
/*
2 4 2
7 6 6 7
10 5 20 15
*/ 
2022/10/3 10:33
加载中...