結果

問題 No.2044 Infinite Nim
コンテスト
ユーザー vjudge1
提出日時 2026-09-17 10:06:32
言語 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
+ 133µs
コード長 1,312 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 943 ms
コンパイル使用メモリ 181,648 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-17 10:06:36
合計ジャッジ時間 3,523 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// Problem: A - Infinite Nim
// Contest: Virtual Judge - Game theory*
// URL: https://vjudge.net/contest/850173#problem/A
// Memory Limit: 512 MB
// Time Limit: 2000 ms

#include <bits/stdc++.h>
#define ll long long
#define db double
#define sti string
#define vt vector
#define pii pair<int, int>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define pdd pair<db, db>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << '\n';
#define bit(mask, i) (((mask) >> (i)) & 1)
#define fi first
#define sc second

using namespace std;

const sti name = "";
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const ll BASE = 311;
const int MAXN = 1e6;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

void file () {
    freopen((name + ".inp").c_str(), "r", stdin);
    freopen((name + ".out").c_str(), "w", stdout);
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    if (fopen((name + ".inp").c_str(), "r")) file();

    int n, cnt = 0, g = 0; cin >> n;
    for (int i = 1; i <= n; ++i) {
        int x; cin >> x;
        if (x == -1) cnt ^= 1;
        else g ^= x;
    }
    cout << (cnt || g ? "First" : "Second") << '\n';

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
}
0