社区讨论
70分求救,TLE了三个
P1309[NOIP 2011 普及组] 瑞士轮参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @m6hce3w9
- 此快照首次捕获于
- 2025/01/29 11:24 去年
- 此快照最后确认于
- 2025/11/04 10:11 4 个月前
CPP
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct node{
int score,b,shili;
}a[401000];
bool cmp(node x,node y){
if(x.score==y.score)return x.b<y.b;
return x.score>y.score;
}
void game(node &x,node &y){
if(x.shili>y.shili)x.score++;
else y.score++;
}
int N,R,Q;
signed main(){
scanf("%lld%lld%lld",&N,&R,&Q);
for(int i=1;i<=2*N;i++){
scanf("%d",&a[i].score);
a[i].b=i;
}
for(int i=1;i<=2*N;i++)
scanf("%lld",&a[i].shili);
while(R--){
sort(a+1,a+2*N+1,cmp);
for(int i=1;i<=2*N-1;i+=2)
game(a[i],a[i+1]);
}
sort(a+1,a+2*N+1,cmp);
printf("%lld",a[Q].b);
return 0;
}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...