70分求救,TLE了三个
查看原帖
70分求救,TLE了三个
1104834
lucky213楼主2025/1/29 11:22
#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;
}
2025/1/29 11:22
加载中...