結果

問題 No.715 集合と二人ゲーム
ユーザー rpy3cpprpy3cpp
提出日時 2018-08-11 21:29:21
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 911 bytes
コンパイル時間 1,847 ms
コンパイル使用メモリ 174,192 KB
実行使用メモリ 5,316 KB
最終ジャッジ日時 2023-10-24 14:06:19
合計ジャッジ時間 6,036 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 3 ms
4,372 KB
testcase_05 AC 4 ms
4,372 KB
testcase_06 WA -
testcase_07 AC 5 ms
4,372 KB
testcase_08 AC 4 ms
4,372 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 5 ms
4,372 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 6 ms
4,372 KB
testcase_16 WA -
testcase_17 AC 7 ms
4,372 KB
testcase_18 WA -
testcase_19 AC 8 ms
4,372 KB
testcase_20 WA -
testcase_21 AC 9 ms
4,372 KB
testcase_22 WA -
testcase_23 AC 9 ms
4,372 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 12 ms
4,372 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 9 ms
4,372 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 2 ms
4,372 KB
testcase_36 AC 2 ms
4,372 KB
testcase_37 WA -
testcase_38 AC 2 ms
4,372 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 2 ms
4,372 KB
testcase_42 WA -
testcase_43 AC 2 ms
4,372 KB
testcase_44 WA -
testcase_45 AC 2 ms
4,372 KB
testcase_46 WA -
testcase_47 AC 2 ms
4,372 KB
testcase_48 WA -
testcase_49 AC 2 ms
4,372 KB
testcase_50 WA -
testcase_51 AC 61 ms
5,316 KB
testcase_52 AC 59 ms
5,316 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 60 ms
5,052 KB
testcase_56 WA -
testcase_57 AC 54 ms
5,052 KB
testcase_58 WA -
testcase_59 AC 61 ms
5,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0