题解2
2023-11-19 15:44:12
发布于:广东
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
struct Player{
int id;
int score;
int power;
}arr[1000002];
bool cmp(Player a,Player b){
if(a.score==b.score){
return a.id<b.id;
}
return a.score>b.score;
}
int main(){
int n,r,q;
cin>>n>>r>>q;
for(int i=1;i<=2n;i++){
cin>>arr[i].score;
arr[i].id=i;
}
for(int i=1;i<=2n;i++){
cin>>arr[i].power;
}
sort(arr+1,arr+1+2n,cmp);
for(int i=1;i<=r;i++){
for(int j=1;j<=2n;j+=2){
if(arr[j].power>arr[j+1].power){
arr[j].score+=1;
}else{
arr[j+1].score+=1;
}
}
sort(arr+1,arr+1+2*n,cmp);
}
cout<<arr[q].id;
return 0;
}
这里空空如也
有帮助,赞一个