瑞士轮
查看原帖
瑞士轮
770679
abab123楼主2022/11/21 19:23

//瑞士轮 //提好几遍90 //一模一样就100

#include<bits/stdc++.h>
using namespace std;
int n,q,r;
struct data
{
	int cj,xh,sl;
}f[200002];
bool com(data a,data b)
{
	if(a.cj==b.cj)
	  return a.xh<b.xh;
	return a.cj>b.cj;
}
int main()
{
	scanf("%d%d%d",&n,&r,&q);
	const int m=2*n;
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&f[i].cj);
		f[i].xh=i;
	}
	for(int i=1;i<=m;i++)
	  scanf("%d",&f[i].sl);
	while(r--)
	{
		stable_sort(f+1,f+m+1,com);
		for(int i=1;i<=m;i+=2)
		{
			if(f[i].sl>f[i+1].sl)
			  f[i].cj++;
			else
			  f[i+1].cj++;
		}
	}
	stable_sort(f+1,f+m+1,com);
	printf("%d",f[q].xh);
	return 0;
}
2022/11/21 19:23
加载中...