結果

問題 No.715 集合と二人ゲーム
ユーザー 👑 kmjpkmjp
提出日時 2018-07-13 23:27:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 331 ms / 2,000 ms
コード長 1,281 bytes
コンパイル時間 1,511 ms
コンパイル使用メモリ 164,972 KB
実行使用メモリ 41,856 KB
最終ジャッジ日時 2024-04-17 11:38:15
合計ジャッジ時間 7,293 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,376 KB
testcase_01 AC 4 ms
5,632 KB
testcase_02 AC 6 ms
5,632 KB
testcase_03 AC 6 ms
5,632 KB
testcase_04 AC 7 ms
5,760 KB
testcase_05 AC 9 ms
6,144 KB
testcase_06 AC 10 ms
6,272 KB
testcase_07 AC 11 ms
6,272 KB
testcase_08 AC 12 ms
6,528 KB
testcase_09 AC 13 ms
6,784 KB
testcase_10 AC 14 ms
6,912 KB
testcase_11 AC 15 ms
7,040 KB
testcase_12 AC 16 ms
6,944 KB
testcase_13 AC 19 ms
7,168 KB
testcase_14 AC 19 ms
7,296 KB
testcase_15 AC 20 ms
7,424 KB
testcase_16 AC 22 ms
7,680 KB
testcase_17 AC 21 ms
7,680 KB
testcase_18 AC 26 ms
7,936 KB
testcase_19 AC 24 ms
7,936 KB
testcase_20 AC 28 ms
8,448 KB
testcase_21 AC 29 ms
8,448 KB
testcase_22 AC 31 ms
8,576 KB
testcase_23 AC 30 ms
8,576 KB
testcase_24 AC 33 ms
8,832 KB
testcase_25 AC 33 ms
8,960 KB
testcase_26 AC 33 ms
8,832 KB
testcase_27 AC 37 ms
9,216 KB
testcase_28 AC 39 ms
9,472 KB
testcase_29 AC 39 ms
9,600 KB
testcase_30 AC 43 ms
9,856 KB
testcase_31 AC 38 ms
9,344 KB
testcase_32 AC 34 ms
8,704 KB
testcase_33 AC 44 ms
10,112 KB
testcase_34 AC 39 ms
9,216 KB
testcase_35 AC 3 ms
5,504 KB
testcase_36 AC 3 ms
5,376 KB
testcase_37 AC 3 ms
5,504 KB
testcase_38 AC 3 ms
5,376 KB
testcase_39 AC 3 ms
5,376 KB
testcase_40 AC 4 ms
5,376 KB
testcase_41 AC 4 ms
5,376 KB
testcase_42 AC 4 ms
5,376 KB
testcase_43 AC 4 ms
5,376 KB
testcase_44 AC 4 ms
5,504 KB
testcase_45 AC 4 ms
5,376 KB
testcase_46 AC 4 ms
5,376 KB
testcase_47 AC 4 ms
5,376 KB
testcase_48 AC 4 ms
5,376 KB
testcase_49 AC 4 ms
5,376 KB
testcase_50 AC 321 ms
41,856 KB
testcase_51 AC 262 ms
32,512 KB
testcase_52 AC 313 ms
41,728 KB
testcase_53 AC 274 ms
37,888 KB
testcase_54 AC 251 ms
35,584 KB
testcase_55 AC 316 ms
37,504 KB
testcase_56 AC 331 ms
41,856 KB
testcase_57 AC 255 ms
35,072 KB
testcase_58 AC 291 ms
36,096 KB
testcase_59 AC 241 ms
32,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
set<int> S;

int gr[505050];

int hoge(int v) {
	if(gr[v]>=0) return gr[v];
	
	int mask=0;
	for(int i=1;i<=min(50,v);i++) {
		int L=max(0,i-2);
		int R=max(0,v-(i+1));
		mask |= 1<<(hoge(L)^hoge(R));
	}
	gr[v]=0;
	while(mask & (1<<gr[v])) gr[v]++;
	return gr[v];
	
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	MINUS(gr);
	cin>>N;
	FOR(i,N) cin>>x, S.insert(x);
	
	int pre=*S.begin(),first=*S.begin();
	int nim=0;
	FORR(s,S) {
		if(s>pre+1) {
			nim ^= hoge(pre-first+1);
			first=s;
		}
		pre=s;
	}
	nim ^= hoge(pre-first+1);
	
	if(nim==0) cout<<"Second"<<endl;
	else cout<<"First"<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0