如题,样例过了,RE了三个点
#include<iostream>
#include<algorithm>
#define dehere for(int i=1;i<=n;i++)cout<<st[i].k<<' '<<st[i].sc<<'\n'
using namespace std;
int n,r,q;
struct node{int sc,pw,k;}st[100005];
bool cmp(node a,node b){return a.sc==b.sc?a.k<b.k:a.sc>b.sc;}
int main(){
cin>>n>>r>>q;
for(int i=1;i<=n*2;i++)scanf("%d",&st[i].sc);
for(int i=1;i<=n*2;i++)scanf("%d",&st[i].pw);
for(int i=1;i<=n*2;i++)st[i].k=i;
sort(st+1,st+n*2+1,cmp);
while(r--){
node win[n+1],los[n+1];
for(int i=1;i<=n;i++){
if(st[i*2-1].pw>st[i*2].pw){
st[i*2-1].sc++;
win[i]=st[i*2-1];
los[i]=st[i*2];
}else{
st[i*2].sc++;
win[i]=st[i*2];
los[i]=st[i*2-1];
}
}
int idxw=1,idxl=1,idx=0;
while(idxw<=n&&idxl<=n){
if(cmp(win[idxw],los[idxl]))st[++idx]=win[idxw++];
else st[++idx]=los[idxl++];
}
while(idxw<=n)st[++idx]=win[idxw++];
while(idxl<=n)st[++idx]=los[idxl++];
}
cout<<st[q].k<<endl;
return 0;
}