結果
問題 | No.715 集合と二人ゲーム |
ユーザー |
|
提出日時 | 2018-07-13 23:24:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 67 ms / 2,000 ms |
コード長 | 1,152 bytes |
コンパイル時間 | 2,231 ms |
コンパイル使用メモリ | 177,600 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 05:42:37 |
合計ジャッジ時間 | 5,630 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 60 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int dp[500001];int solve(int x) {set<int> s;s.insert(dp[x - 2]);s.insert(dp[x - 3]);for (int i = 1; i <= x - 4; i++) {s.insert(dp[i] ^ dp[x - i - 3]);}int res = 0;while (s.find(res) != s.end()) res++;return dp[x] = res;}int main() {cin.tie(0);ios::sync_with_stdio(false);//cout << "{";//cout << 0 << "," << 1 << "," << 1 << "," << 2;dp[1] = 1;dp[2] = 1;dp[3] = 2;for (int i = 4; i <= 1000; i++) {solve(i);}//cout << "};" << endl;int n;cin >> n;vector<int> a(n);for (int i = 0; i < n; i++) {cin >> a[i];}sort(a.begin(), a.end());int cnt = 1;vector<int> v;for (int i = 1; i < n; i++) {if (a[i] - a[i - 1] > 1) {v.push_back(cnt);cnt = 1;} else {cnt++;}}v.push_back(cnt);int hoge = 0;for (int x : v) hoge ^= dp[(x <= 1000 ? x : x - (x - 1000 + 33) / 34 * 34)];cout << (hoge == 0 ? "Second" : "First") << endl;return 0;}