結果

問題 No.2044 Infinite Nim
ユーザー platinum
提出日時 2022-05-05 22:16:28
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 2,071 ms
コンパイル使用メモリ 192,080 KB
最終ジャッジ日時 2025-01-29 02:30:54
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)

using namespace std;

const int Max_N = (int)1e5;
const int Max_A = (int)1e9;

int main(){
    int N;
    cin >> N;
    assert(1 <= N && N <= Max_N);
    int g = 0, inf = 0;
    rep(i,N){
        int a;
        cin >> a;
        assert(a == -1 || (1 <= a && a <= Max_A));
        if(a == -1) inf ^= 1;
        else g ^= a;
    }
    if(inf == 1) cout << "First" << endl;
    else if(g != 0) cout << "First" << endl;
    else cout << "Second" << endl;
    
    return 0;
}
0