社区讨论
求大佬,不知道错哪了,p1309瑞士轮
题目总版参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mi6u9h1m
- 此快照首次捕获于
- 2025/11/20 10:55 4 个月前
- 此快照最后确认于
- 2025/11/20 10:55 4 个月前
CPP
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
struct peo{
int bian;
int chu;
int shi;
}ren[200000];
int cmd(peo a,peo b){
if(a.chu==b.chu){
return a.bian<b.bian;
}
return a.chu>b.chu;
}
int main()
{
int n,r,q,x=0,y=0,cb,cc,cs;
scanf("%d %d %d",&n,&r,&q);
while(x<2*n){
scanf("%d",&ren[x].chu);
x++;
}
x=0;
while(x<2*n){
scanf("%d",&ren[x].shi);
x++;
}
x=0;
while(x<2*n){
ren[x].bian=x+1;
x++;
}
sort(ren,ren+2*n,cmd);
x=0;
while(y<r){
while(x<=2*n-2){
if(ren[x+1].shi>ren[x].shi){
ren[x+1].chu++;
}
if(ren[x].shi>ren[x+1].shi){
ren[x].chu++;
}
x=x+2;
}
sort(ren,ren+2*n,cmd);
y++;
}
sort(ren,ren+2*n,cmd);
printf("%d",ren[q-1].bian);
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...