結果

問題 No.2044 Infinite Nim
ユーザー Manuel1024Manuel1024
提出日時 2023-09-10 07:49:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 623 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 69,744 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-10 07:49:20
合計ジャッジ時間 3,023 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 17 ms
4,376 KB
testcase_14 AC 10 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 24 ms
4,384 KB
testcase_18 WA -
testcase_19 AC 8 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 10 ms
4,380 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 22 ms
4,380 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 17 ms
4,376 KB
testcase_30 AC 18 ms
4,380 KB
testcase_31 AC 31 ms
4,384 KB
testcase_32 AC 31 ms
4,376 KB
testcase_33 AC 31 ms
4,380 KB
testcase_34 AC 18 ms
4,380 KB
testcase_35 AC 41 ms
4,380 KB
testcase_36 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int n; cin >> n;
    vector<int> a(n);
    for(auto &it: a) cin >> it;

    int infcnt = 0;
    int g = 0;
    for(auto &it: a){
        if(it == -1) infcnt++;
        else g ^= it;
    }

    if(infcnt == 0) cout << (g == 0 ? "Second" : "First") << endl;
    else{
        if(infcnt == 1) cout << "First" << endl;
        else if(infcnt%2 == 0){
            cout << ((n-infcnt)%2 == 0 ? "Second" : "First") << endl;
        }else{
            cout << ((n-infcnt)%2 == 0 && infcnt < n ? "Second" : "First") << endl;
        }
    }
    return 0;
}
0