結果

問題 No.715 集合と二人ゲーム
ユーザー noisy_noiminnoisy_noimin
提出日時 2018-07-26 15:28:12
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,356 bytes
コンパイル時間 3,508 ms
コンパイル使用メモリ 177,184 KB
実行使用メモリ 5,600 KB
最終ジャッジ日時 2023-09-13 18:41:06
合計ジャッジ時間 9,569 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
4,380 KB
testcase_01 AC 28 ms
4,376 KB
testcase_02 AC 29 ms
4,376 KB
testcase_03 AC 29 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 30 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 31 ms
4,380 KB
testcase_12 AC 31 ms
4,376 KB
testcase_13 AC 32 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 33 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 32 ms
4,376 KB
testcase_18 WA -
testcase_19 AC 34 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 34 ms
4,376 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 35 ms
4,380 KB
testcase_26 WA -
testcase_27 AC 37 ms
4,376 KB
testcase_28 WA -
testcase_29 AC 37 ms
4,380 KB
testcase_30 WA -
testcase_31 AC 35 ms
4,380 KB
testcase_32 WA -
testcase_33 AC 36 ms
4,376 KB
testcase_34 WA -
testcase_35 AC 27 ms
4,376 KB
testcase_36 WA -
testcase_37 AC 28 ms
4,376 KB
testcase_38 AC 27 ms
4,380 KB
testcase_39 AC 28 ms
4,376 KB
testcase_40 AC 28 ms
4,376 KB
testcase_41 AC 28 ms
4,380 KB
testcase_42 AC 28 ms
4,380 KB
testcase_43 AC 28 ms
4,376 KB
testcase_44 AC 28 ms
4,380 KB
testcase_45 AC 27 ms
4,380 KB
testcase_46 AC 28 ms
4,376 KB
testcase_47 AC 27 ms
4,376 KB
testcase_48 AC 27 ms
4,380 KB
testcase_49 AC 28 ms
4,376 KB
testcase_50 WA -
testcase_51 AC 84 ms
5,544 KB
testcase_52 AC 83 ms
5,344 KB
testcase_53 AC 82 ms
5,324 KB
testcase_54 AC 82 ms
5,352 KB
testcase_55 AC 84 ms
5,328 KB
testcase_56 WA -
testcase_57 AC 77 ms
5,108 KB
testcase_58 WA -
testcase_59 AC 84 ms
5,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 10e-10;

struct Game{
    map<int, int> mp;
    Game(int n){
        dfs(n);
    }

    int dfs(int n){
        if(n <= 0) return 0;
        else if(mp[n] != 0) return mp[n];

        set<int> used;
        used.insert(dfs(n-2));
        used.insert(dfs(n-3));
        for(int i=3;i<=(n+1)/2;i++){
            used.insert(dfs(i-2)^dfs(n-(i+1)));
        }

        int g = 0;
        while(used.find(g) != used.end()) g++;
        mp[n] = g;
        return g;
    }
};

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    Game game = Game(80);

    int n;
    cin >> n;
    int a[n];
    rep(n) cin >> a[i];
    sort(a, a+n);
    int m = 1, grundy = 0;
    reppp(i, 1, n){
        if(a[i] - a[i-1] <= 1){
            m++;
        }else{
            if(m > 80) m -= m/34*34;
            grundy ^= game.mp[m];
            m = 1;
        }
    }
    if(m > 1) grundy ^= game.mp[m];

    cout << (grundy?"First":"Second") << endl;
}
0