結果

問題 No.715 集合と二人ゲーム
ユーザー parukiparuki
提出日時 2018-07-17 12:30:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 182 ms / 2,000 ms
コード長 1,693 bytes
コンパイル時間 1,953 ms
コンパイル使用メモリ 175,100 KB
実行使用メモリ 26,880 KB
最終ジャッジ日時 2024-05-03 16:02:12
合計ジャッジ時間 6,886 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 4 ms
5,376 KB
testcase_04 AC 6 ms
5,376 KB
testcase_05 AC 7 ms
5,376 KB
testcase_06 AC 8 ms
5,376 KB
testcase_07 AC 9 ms
5,376 KB
testcase_08 AC 9 ms
5,376 KB
testcase_09 AC 11 ms
5,376 KB
testcase_10 AC 11 ms
5,376 KB
testcase_11 AC 13 ms
5,376 KB
testcase_12 AC 13 ms
5,376 KB
testcase_13 AC 15 ms
5,376 KB
testcase_14 AC 17 ms
5,376 KB
testcase_15 AC 17 ms
5,376 KB
testcase_16 AC 18 ms
5,632 KB
testcase_17 AC 18 ms
5,504 KB
testcase_18 AC 21 ms
6,016 KB
testcase_19 AC 21 ms
6,016 KB
testcase_20 AC 24 ms
6,144 KB
testcase_21 AC 25 ms
6,272 KB
testcase_22 AC 26 ms
6,400 KB
testcase_23 AC 25 ms
6,528 KB
testcase_24 AC 29 ms
6,784 KB
testcase_25 AC 28 ms
6,912 KB
testcase_26 AC 28 ms
6,784 KB
testcase_27 AC 32 ms
7,168 KB
testcase_28 AC 34 ms
7,296 KB
testcase_29 AC 35 ms
7,424 KB
testcase_30 AC 26 ms
6,912 KB
testcase_31 AC 23 ms
6,528 KB
testcase_32 AC 22 ms
6,144 KB
testcase_33 AC 25 ms
6,656 KB
testcase_34 AC 22 ms
6,144 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 3 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 2 ms
5,376 KB
testcase_45 AC 2 ms
5,376 KB
testcase_46 AC 2 ms
5,376 KB
testcase_47 AC 2 ms
5,376 KB
testcase_48 AC 2 ms
5,376 KB
testcase_49 AC 2 ms
5,376 KB
testcase_50 AC 180 ms
26,752 KB
testcase_51 AC 179 ms
26,752 KB
testcase_52 AC 179 ms
26,752 KB
testcase_53 AC 179 ms
26,752 KB
testcase_54 AC 176 ms
26,752 KB
testcase_55 AC 176 ms
26,624 KB
testcase_56 AC 170 ms
25,344 KB
testcase_57 AC 158 ms
23,936 KB
testcase_58 AC 181 ms
26,880 KB
testcase_59 AC 182 ms
26,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

int dp[2001];
int g(int n) {
    if (dp[n] != -1)RT dp[n];
    set<int> S;
    for (int i = 0; i < n; ++i) {
        int l = max(0, i - 1);
        int r = max(n - 2 - i, 0);
        S.insert(g(l) ^ g(r));
    }
    int re = 0;
    while (S.count(re))re++;;
    return dp[n] = re;
}

void test(int n) {
    MEM(dp, -1);
    cout << n << endl;
    rep(i, n) {
        cout << g(i) << endl;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    MEM(dp, -1);
    rep(i, 88)g(i);

    int N;
    cin >> N;
    set<int> S;
    rep(i, N) {
        int a;
        cin >> a;
        S.insert(a);
    }
    S.insert((int)1e9 + 1);

    int sm = 0, cnt = 0, pre = -1;
    for (int x : S) {
        if (x - pre > 1) {
            int y = cnt >= 54 ? (cnt - 54) % 34 + 54 : cnt;
            sm^=dp[y];
            cnt = 1;
        } else {
            cnt++;
        }
        pre = x;
    }
    
    cout << (sm ? "First" : "Second") << endl;
}
0