結果
| 問題 |
No.715 集合と二人ゲーム
|
| コンテスト | |
| ユーザー |
jell
|
| 提出日時 | 2019-06-08 14:23:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 937 bytes |
| コンパイル時間 | 1,750 ms |
| コンパイル使用メモリ | 175,532 KB |
| 実行使用メモリ | 7,296 KB |
| 最終ジャッジ日時 | 2024-10-05 22:15:29 |
| 合計ジャッジ時間 | 4,686 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 60 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int g[500001];
int n;
vector<int> a;
int ans;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
g[0]=0;
g[1]=1;
g[2]=1;
for(int i=3; i<130; ++i) {
priority_queue<int,vector<int>,greater<int>> que;
que.emplace(g[i-2]);
for(int j=0; j*2<=i-3; ++j) {
que.emplace(g[j]^g[i-3-j]);
}
while(!que.empty()) {
int t=que.top();
que.pop();
if(t>g[i]) break;
if(t==g[i]) g[i]++;
}
}
for(int i=130; i<500001; ++i) {
g[i]=g[i-68];
}
cin>>n;
a.resize(n);
for(int i=0; i<n; ++i) cin>>a[i];
sort(begin(a),end(a));
for(int i=0; i<n; ++i) {
int j=i+1;
while(j<n && a[j]-a[i]==j-i) {
++j;
}
ans^=g[j-i];
i=j-1;
}
if(ans) cout<<"First"<<endl;
else cout<<"Second"<<endl;
}
jell