AC

汤园是只猫  •  1个月前


include <bits/stdc++.h>

using namespace std;

struct race {

int id;
int fs;
int sl;

} a[1000005];

bool cmp(race x, race y) {

if (x.fs == y.fs ){
		return x.id < y.id;
}
else{
	return x.fs > y.fs  ;
}

}

int main() {

freopen("swiss.in", "r", stdin);
freopen("swiss.out", "w", stdout);
int n, r, q;
cin >> n >> r >> q;
for (int i = 1; i <= 2 * n; i++){
	a[i].id = i;
}
for (int i = 1; i <= 2 * n; i++) {
	cin >> a[i].fs;
}
for (int i = 1; i <= 2 * n; i++){
	cin >> a[i].sl  ;
}
sort(a + 1, a + 1 + 2 * n, cmp);
for (int i = 1; i <= r; i++) {
	for (int j = 1; j <= 2 * n; j += 2) {
		if (a[j].sl > a[j + 1].sl ){
				a[j].fs ++;
		}
		else{
			a[j + 1].fs ++;
		}
	}
	sort(a + 1, a + 2 * n + 1, cmp);
}
cout << a[q].id ;
return 0;

}


评论:

请先登录,才能进行评论