結果

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

ソースコード

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