結果

問題 No.3090 NimNim
ユーザー SnowBeenDiding
提出日時 2025-04-04 22:48:55
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 792 bytes
コンパイル時間 4,970 ms
コンパイル使用メモリ 332,844 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-04-04 22:49:03
合計ジャッジ時間 6,501 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m);
    int gra = 0, grb = 0;
    rep(i, 0, n) {
        cin >> a[i];
        gra ^= a[i];
    }
    rep(i, 0, m) {
        cin >> b[i];
        grb ^= b[i];
    }
    if (gra >= 2) {
        cout << "First\n";
        return 0;
    }
    if (gra == 1) {
        cout << (grb == 0 ? "Second" : "First") << "\n";
        return 0;
    }
    bool all1 = true;
    rep(i, 0, n) all1 &= (a[i] == 1);
    if (all1) {
        cout << "First\n";
        return 0;
    }
    cout << "Second\n";
}
0