結果

問題 No.1208 anti primenumber game
ユーザー Atomic67
提出日時 2020-09-11 01:37:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 1,602 bytes
コンパイル時間 1,998 ms
コンパイル使用メモリ 168,656 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 05:43:50
合計ジャッジ時間 4,509 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

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

template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
struct Unionfind {
    vector<int> par;

    Unionfind(int n) : par(n) {
        for(int i = 0; i < n; ++i) par[i] = i;
    }

    int root(int x) {
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        par[rx] =ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n;
    ll m;
    cin >> n >> m;
    int p = -1;

    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    for(int i = 0; i < n; ++i) {
        if(a[i] != 1) {
            p = i;
            break;
        }
    }


    if(p == -1) {
        if(m == 0 && ((n % 2) == 1)) {
            cout << "First" << endl;
            return 0;
        }
        else {
            cout << "Second" << endl;
            return 0;
        }
    }

    else {
        if(p % 2 == 0) {
            cout << "First" << endl;
            return 0;
        }
        else {
            cout << "Second" << endl;
            return 0;
        }
    }
}
0