900ms压线AC
2025-02-13 08:29:11
发布于:北京
12阅读
0回复
0点赞
当时我是提交弱化版代码,没想到900ms压线过
#include<bits/stdc++.h>
#define int long long
using namespace std;
struct node{
int score,sl,pm,id;
}a[200005];
bool cmp(node a,node b){
if(a.score != b.score) return a.score > b.score;
else return a.id < b.id;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n,r,q; cin >> n >> r >> q;
for(int i = 1;i <= n * 2;i++) cin >> a[i].score;
for(int i = 1;i <= n * 2;i++){
cin >> a[i].sl;
a[i].id = i;
}
while(r--){
sort(a + 1,a + n * 2 + 1,cmp);
for(int i = 1;i <= n * 2;i += 2){
if(a[i].sl > a[i + 1].sl) a[i].score++;
else a[i + 1].score++;
}
}
sort(a + 1,a + n * 2 + 1,cmp);
cout << a[q].id;
return 0;
}
这里空空如也
有帮助,赞一个