結果

問題 No.2044 Infinite Nim
ユーザー ripity
提出日時 2022-11-01 19:22:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 195,876 KB
最終ジャッジ日時 2025-02-08 16:45:59
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, xor_acc = 0, cnt_inf = 0;
    cin >> N;
    vector<string> ans = {"Second", "First"};
    for( int i = 0; i < N; i++ ) {
        int A;
        cin >> A;
        if( A == -1 ) cnt_inf++;
        else xor_acc ^= A;
    }
    if( cnt_inf == 0 ) {
        cout << ans[0<xor_acc] << endl;
    }else if( (cnt_inf&1) == 1 ) {
        cout << ans[1] << endl;
    }else {
        cout << ans[((0==xor_acc)^N)&1] << endl;
    }
}
0