結果
問題 |
No.715 集合と二人ゲーム
|
ユーザー |
![]() |
提出日時 | 2025-05-13 04:08:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,240 bytes |
コンパイル時間 | 2,127 ms |
コンパイル使用メモリ | 206,556 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-05-13 04:08:48 |
合計ジャッジ時間 | 8,371 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 WA * 15 RE * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; template<class S, class T> inline bool chmax(S &a, T b) { return (a < b ? a = b, 1 : 0); } template<class S, class T> inline bool chmin(S &a, T b) { return (a > b ? a = b, 1 : 0); } using pint = pair<int, int>; using pll = pair<long long, long long>; using tint = array<int, 3>; using tll = array<long long, 3>; using fint = array<int, 4>; using fll = array<long long, 4>; using vint = vector<int>; using vll = vector<long long>; using ll = long long; using u32 = unsigned int; using u64 = unsigned long long; using int128 = __int128; using u128 = unsigned __int128; template <class T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>; #define REP(i, a) for (long long i = 0; i < (long long)(a); i++) #define REP2(i, a, b) for (long long i = a; i < (long long)(b); i++) #define RREP(i, a) for (long long i = (a)-1; i >= (long long)(0); --i) #define RREP2(i, a, b) for (long long i = (b)-1; i >= (long long)(a); --i) #define EB emplace_back #define PB push_back #define MP make_pair #define MT make_tuple #define FI first #define SE second #define ALL(x) x.begin(), x.end() #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl // debug stream template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) { return s << '<' << P.first << ", " << P.second << '>'; } template<class T> ostream& operator << (ostream &s, vector<T> P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template<class T> ostream& operator << (ostream &s, deque<T> P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) { for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; } template<class T> ostream& operator << (ostream &s, set<T> P) { for (auto it : P) { s << "<" << it << "> "; } return s; } template<class T> ostream& operator << (ostream &s, multiset<T> P) { for (auto it : P) { s << "<" << it << "> "; } return s; } template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) { for (auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s; } int main() { int M = 110; vector<int> dp(M, 0); dp[0] = 0; dp[1] = 1; REP2(n, 2, M) { set<int> S; //if (n-1 >= 0) S.insert(dp[n-1]); if (n-2 >= 0) S.insert(dp[n-2]); if (n-3 >= 0) S.insert(dp[n-3]); REP2(j, 1, n-3) { int k = n-3-j; S.insert(dp[j] ^ dp[k]); if (S.size() > 15) break; } int mex = 0; while (S.count(mex)) mex++; dp[n] = mex; // if (mex >= 9) { // cout << n << ": " << dp[n] << "(" << S << ")" << endl; // } } int N; cin >> N; vector<int> A(N); REP(i, N) cin >> A[i]; sort(A.begin(), A.end()); REP(i, N) A[i] -= i; ll grundy = 0; for (int i = 0; i < N; ) { int j = i; while (j < N && A[j] == A[i]) j++; grundy ^= dp[(j - i)] % 34; //COUT(j-i); i = j; } if (grundy) cout << "First" << endl; else cout << "Second" << endl; }