简单博弈论错第五个求助
查看原帖
简单博弈论错第五个求助
227728
冰糖鸽子TJ鸽子协会楼主2021/3/17 12:40

RT,自己拍小数据没出问题


// Problem: AT1999 [AGC002E] Candy Piles
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/AT1999
// Memory Limit: 250 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define M 100005
int n,ans,a[M],cnt,T;
bool cmp(int A,int B){return A>B;}
int main()
{
	cin>>n;cnt=0;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1,cmp);
	for(ans=1;ans<=n;ans++)
	{
		if(a[ans]<ans)
		{
			ans--;
			break;
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=ans) cnt++;
	}
	if((a[ans]-ans)%2||(cnt-ans)%2)
	{
		cout<<"First"<<endl;
	}
	else
	{
		cout<<"Second"<<endl;
	}
	return 0;
}
2021/3/17 12:40
加载中...