結果

問題 No.946 箱箱箱
ユーザー face4face4
提出日時 2019-12-10 09:31:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 846 ms
コンパイル使用メモリ 76,076 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 02:53:54
合計ジャッジ時間 7,024 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 87 ms
4,376 KB
testcase_04 AC 97 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 98 ms
4,380 KB
testcase_07 AC 99 ms
4,376 KB
testcase_08 AC 101 ms
4,376 KB
testcase_09 AC 23 ms
4,376 KB
testcase_10 AC 81 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 21 ms
4,376 KB
testcase_13 AC 101 ms
4,380 KB
testcase_14 AC 98 ms
4,376 KB
testcase_15 AC 88 ms
4,380 KB
testcase_16 AC 80 ms
4,380 KB
testcase_17 AC 85 ms
4,380 KB
testcase_18 AC 98 ms
4,380 KB
testcase_19 AC 83 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 49 ms
4,380 KB
testcase_22 AC 94 ms
4,380 KB
testcase_23 AC 97 ms
4,376 KB
testcase_24 AC 23 ms
4,376 KB
testcase_25 AC 83 ms
4,376 KB
testcase_26 AC 77 ms
4,376 KB
testcase_27 AC 89 ms
4,376 KB
testcase_28 AC 88 ms
4,384 KB
testcase_29 AC 101 ms
4,380 KB
testcase_30 AC 95 ms
4,376 KB
testcase_31 AC 97 ms
4,376 KB
testcase_32 AC 91 ms
4,380 KB
testcase_33 AC 92 ms
4,380 KB
testcase_34 AC 100 ms
4,376 KB
testcase_35 AC 95 ms
4,380 KB
testcase_36 AC 97 ms
4,380 KB
testcase_37 AC 97 ms
4,380 KB
testcase_38 AC 84 ms
4,380 KB
testcase_39 AC 91 ms
4,376 KB
testcase_40 AC 57 ms
4,376 KB
testcase_41 AC 90 ms
4,376 KB
testcase_42 AC 87 ms
4,376 KB
testcase_43 AC 98 ms
4,376 KB
testcase_44 AC 82 ms
4,376 KB
testcase_45 AC 97 ms
4,376 KB
testcase_46 AC 97 ms
4,376 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 AC 2 ms
4,380 KB
testcase_52 WA -
testcase_53 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)  cin >> a[i];
    for(int i = 1; i < n; i++)  a[i] ^= a[i-1];
    int grundy[n+1];
    grundy[n] = 0;
    for(int i = n-1; i >= 0; i--){
        vector<int> v;
        for(int j = i+1; j <= n; j++)   v.push_back(a[j-1]^grundy[j]);
        sort(v.begin(), v.end());
        v.erase(unique(v.begin(),v.end()),v.end());
        for(int j = 0;;j++){
            if(j >= v.size() || v[j] != j){
                grundy[i] = j;
                break;
            }
        }
    }
    cout << (grundy[0] ? "Takahashi" : "Takanashi") << endl;
    return 0;
}
0