結果

問題 No.715 集合と二人ゲーム
ユーザー ahe100ahe100
提出日時 2018-07-15 13:59:51
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 1,366 bytes
コンパイル時間 1,256 ms
コンパイル使用メモリ 94,084 KB
実行使用メモリ 11,208 KB
最終ジャッジ日時 2023-08-06 05:03:13
合計ジャッジ時間 6,437 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,544 KB
testcase_01 AC 5 ms
7,760 KB
testcase_02 AC 5 ms
7,964 KB
testcase_03 AC 7 ms
8,156 KB
testcase_04 AC 8 ms
8,672 KB
testcase_05 AC 9 ms
8,632 KB
testcase_06 AC 10 ms
7,584 KB
testcase_07 AC 11 ms
8,476 KB
testcase_08 AC 11 ms
8,328 KB
testcase_09 AC 13 ms
8,076 KB
testcase_10 AC 12 ms
8,040 KB
testcase_11 AC 14 ms
7,872 KB
testcase_12 AC 14 ms
8,364 KB
testcase_13 AC 16 ms
8,224 KB
testcase_14 AC 17 ms
7,860 KB
testcase_15 AC 18 ms
8,308 KB
testcase_16 AC 19 ms
7,960 KB
testcase_17 AC 19 ms
7,712 KB
testcase_18 AC 22 ms
8,452 KB
testcase_19 AC 22 ms
7,904 KB
testcase_20 AC 24 ms
8,572 KB
testcase_21 AC 25 ms
8,500 KB
testcase_22 AC 26 ms
8,044 KB
testcase_23 AC 26 ms
9,096 KB
testcase_24 AC 28 ms
8,208 KB
testcase_25 AC 27 ms
8,668 KB
testcase_26 AC 27 ms
8,084 KB
testcase_27 AC 32 ms
11,124 KB
testcase_28 AC 32 ms
8,264 KB
testcase_29 AC 32 ms
8,644 KB
testcase_30 AC 29 ms
8,812 KB
testcase_31 AC 25 ms
7,788 KB
testcase_32 AC 23 ms
7,912 KB
testcase_33 AC 26 ms
8,220 KB
testcase_34 AC 24 ms
8,116 KB
testcase_35 AC 3 ms
7,292 KB
testcase_36 AC 3 ms
8,336 KB
testcase_37 AC 4 ms
7,636 KB
testcase_38 AC 3 ms
7,616 KB
testcase_39 AC 4 ms
8,688 KB
testcase_40 AC 4 ms
7,384 KB
testcase_41 AC 4 ms
7,608 KB
testcase_42 AC 4 ms
8,100 KB
testcase_43 AC 4 ms
8,544 KB
testcase_44 AC 4 ms
7,880 KB
testcase_45 AC 4 ms
8,520 KB
testcase_46 AC 3 ms
7,572 KB
testcase_47 AC 4 ms
7,796 KB
testcase_48 AC 4 ms
8,680 KB
testcase_49 AC 4 ms
8,956 KB
testcase_50 AC 175 ms
11,112 KB
testcase_51 AC 174 ms
11,200 KB
testcase_52 AC 172 ms
11,184 KB
testcase_53 AC 167 ms
11,116 KB
testcase_54 AC 170 ms
11,128 KB
testcase_55 AC 173 ms
11,128 KB
testcase_56 AC 166 ms
11,112 KB
testcase_57 AC 155 ms
11,180 KB
testcase_58 AC 172 ms
11,208 KB
testcase_59 AC 173 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<unordered_set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod = 1e9+7;
ll inf = 1e18;

//WA

int main(void){
	ll n,a[500010],cur=0,grundy[500010],sum=0;
	grundy[0]=0;
	grundy[1]=1;
	grundy[2]=1;
	reg(i,3,88){
		unordered_set<ll> s;
		reg(j,1,(i+1)/2){
			s.insert(grundy[max(0,j-2)] xor grundy[max(0,i-j-1)]);
		}
		rep(j,500010){
			if(s.count(j)==0){
				grundy[i]=j;
				break;
			}
		}
	}
	reg(i,89,500000){
		grundy[i]=grundy[i-34];//周期性を利用(実際に見て確かめるしかない)
	}
	vector<ll> c;
	cin>>n;
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	//連続する個数を求める
	rep(i,n){
		if(cur!=0){
			if(a[i]-a[i-1]<=1){
				cur++;
			}else{
				c.push_back(cur);
				cur=1;
			}
		}else{
			cur=1;
		}
	}
	c.push_back(cur);
	rep(i,c.size()){
		sum = sum xor grundy[c[i]];
	}
	if(sum!=0){
		cout<<"First"<<endl;
	}else{
		cout<<"Second"<<endl;
	}
	return 0;
}
0