結果
問題 | No.715 集合と二人ゲーム |
ユーザー |
|
提出日時 | 2018-08-11 21:29:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 911 bytes |
コンパイル時間 | 1,854 ms |
コンパイル使用メモリ | 174,188 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-23 06:27:21 |
合計ジャッジ時間 | 5,684 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 WA * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; vector<int> num_split(const vector<int> & As){ vector<int> result = {}; int length = 1; for (int i = 1; i < As.size(); ++i){ if (As[i] == As[i - 1] + 1){ ++length; }else{ result.push_back(length); length = 1; } } result.push_back(length); return result; } int main() { cin.tie(0); ios::sync_with_stdio(false); vector<int> g = {0, 3, 1, 2}; int N; cin >> N; vector<int> As(N); for (auto & a : As) cin >> a; sort(As.begin(), As.end()); auto chunks = num_split(As); int grundy = 0; for (auto & m : chunks){ if (m == 1){ grundy ^= 1; }else{ grundy ^= g[m % 4]; } } if (grundy == 0){ cout << "Second" << endl; }else{ cout << "First" << endl; } return 0; }