結果

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

ソースコード

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[xor_acc>0] << endl;
    }else if( (cnt_inf&1) == 1 ) {
        cout << ans[1] << endl;
    }else {
        cout << ans[N&1] << endl;
    }
}
0