結果
問題 | No.715 集合と二人ゲーム |
ユーザー |
![]() |
提出日時 | 2018-07-15 11:36:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,296 bytes |
コンパイル時間 | 1,888 ms |
コンパイル使用メモリ | 173,996 KB |
実行使用メモリ | 5,632 KB |
最終ジャッジ日時 | 2024-10-15 15:21:25 |
合計ジャッジ時間 | 6,662 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 39 WA * 21 |
ソースコード
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; } //--------------------------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------------------------- ∧_∧ ∧_∧ (´<_` ) Welcome to My Coding Space! ( ´_ゝ`) / ⌒i / \ | | / / ̄ ̄ ̄ ̄/ | __(__ニつ/ _/ .| .|____ \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ int N, A[501010]; //--------------------------------------------------------------------------------------------------- int memo[1010]; int g(int x) { if (0 <= memo[x]) return memo[x]; if (x == 0) return memo[x] = 0; if (x <= 2) return memo[x] = 1; set<int> gr; gr.insert(g(x - 2)); gr.insert(g(x - 3)); if (5 <= x) { rep(i, 1, x) { int j = x - i - 3; if (1 <= j) gr.insert(g(i) ^ g(j)); } } int res = 0; while (gr.count(res)) res++; return memo[x] = res; } //--------------------------------------------------------------------------------------------------- void _main() { cin >> N; rep(i, 0, N) cin >> A[i]; sort(A, A + N); rep(i, 0, 1010) memo[i] = -1; //rep(i, 0, 1010) printf("%d : %d\n", i, g(i)); int L = 0; int gr = 0; while (L < N) { int i = L + 1; while (i < N and A[i] <= A[i - 1] + 1) i++; int len = A[i - 1] - A[L] + 1; gr ^= g(len); L = i; } if (gr == 0) printf("Second\n"); else printf("First\n"); }