70pts,dalao求助
查看原帖
70pts,dalao求助
1280145
zxyababab楼主2024/5/24 13:08
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, r, q;
struct node
{
	ll number;
	ll s, w;
	bool operator < (const node v)const
	{
		return s == v.s ? number < v.number : s > v.s;
	}
}g[100010];
int main()
{
	// 请在此输入您的代码
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> r >> q;
	n = 2 * n;
	for(ll i = 1; i <= n; i++)
		cin >> g[i].s;
	for(ll i = 1; i <= n; i++)
	{
		cin >> g[i].w;
		g[i].number = i;
	}
	while(r--)
	{
		sort(g + 1, g + n + 1);
		for(ll i = 1; i <= n; i += 2)
		{
			if(g[i].w >= g[i + 1].w)
				g[i].s++;
			else
				g[i + 1].s++;
		}
	}
	sort(g + 1, g + n + 1);
	cout << g[q].number;
	return 0;
}
2024/5/24 13:08
加载中...