結果

問題 No.2044 Infinite Nim
コンテスト
ユーザー vjudge1
提出日時 2026-09-17 10:08:50
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 6 ms / 2,000 ms
+ 233µs
コード長 1,285 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 965 ms
コンパイル使用メモリ 184,048 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-17 10:08:54
合計ジャッジ時間 3,227 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define psb push_back
#define ppb pop_back
#define all(x) x.begin(), x.end()
using namespace std;

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rand(ll l, ll r){return uniform_int_distribution<ll>(l, r)(rng);}

string file_name = "";

const int inf = 1e9;
const ll inf_ll = 1e18;

void solve(){
    int n;
    cin >> n;

    ll xor_val = 0, xor_omega = 0;

    for (int i=0; i<n; i++){
        ll a;
        cin >> a;
        if (a == -1) xor_omega ^= 1;
        else xor_val ^= a;
    }
    if (xor_omega) cout << "First\n";
    else if (xor_val) cout << "First\n";
    else cout << "Second\n";
}

int main(){
    if (file_name.size()){
        freopen((file_name + ".inp").c_str(), "r", stdin);
        freopen((file_name + ".out").c_str(), "w", stdout);
    }

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    auto start = chrono::high_resolution_clock::now();

    int t=1;
    // cin >> t;
    while (t--) solve();

    auto end = chrono::high_resolution_clock::now();
    auto duration = chrono::duration_cast<chrono::microseconds>(end - start).count();
    cerr << "\n\nRuntime: " << duration / 1000.0 << " ms\n";
}
0