結果

問題 No.3090 NimNim
ユーザー GGanari
提出日時 2025-04-05 15:01:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 897 bytes
コンパイル時間 3,293 ms
コンパイル使用メモリ 219,204 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-04-05 15:01:37
合計ジャッジ時間 5,277 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2")
#include <bits/stdc++.h>
#define INF 1000000001LL
#define LNF 1000000000000000001LL
#define MOD 1000000007LL
#define MAX 200000
#define long long long
#define all(x) x.begin(),x.end()
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0); 
    cin.tie(0);
    
    int n,m;
    cin >> n >> m;

    int xorA = 0;
    int xorB = 0;
    int one = true;

    for(int i = 0; i<n; i++)
    {
        int x;
        cin >> x;
        one&=x == 1;
        xorA^=x;
    }

    for(int i = 0; i<m; i++)
    {
        int x;
        cin >> x;
        xorB^=x;
    }

    if(one)
    {
        if(n&1)
            xorA = xorB;
        else
            xorA = 1;
    }

    if(xorA)
        cout << "First" << endl;
    else
        cout << "Second" << endl;
    return 0;
}
0