結果

問題 No.715 集合と二人ゲーム
ユーザー parukiparuki
提出日時 2018-07-17 12:30:14
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 1,693 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 171,548 KB
実行使用メモリ 26,796 KB
最終ジャッジ日時 2023-08-16 06:57:40
合計ジャッジ時間 7,305 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 4 ms
4,384 KB
testcase_04 AC 5 ms
4,384 KB
testcase_05 AC 6 ms
4,380 KB
testcase_06 AC 7 ms
4,384 KB
testcase_07 AC 8 ms
4,384 KB
testcase_08 AC 9 ms
4,432 KB
testcase_09 AC 10 ms
4,752 KB
testcase_10 AC 11 ms
4,688 KB
testcase_11 AC 13 ms
4,984 KB
testcase_12 AC 13 ms
5,052 KB
testcase_13 AC 14 ms
5,124 KB
testcase_14 AC 16 ms
5,356 KB
testcase_15 AC 16 ms
5,340 KB
testcase_16 AC 18 ms
5,556 KB
testcase_17 AC 18 ms
5,624 KB
testcase_18 AC 21 ms
5,860 KB
testcase_19 AC 22 ms
5,848 KB
testcase_20 AC 23 ms
6,404 KB
testcase_21 AC 24 ms
6,304 KB
testcase_22 AC 26 ms
6,440 KB
testcase_23 AC 26 ms
6,392 KB
testcase_24 AC 28 ms
6,696 KB
testcase_25 AC 28 ms
6,816 KB
testcase_26 AC 29 ms
6,708 KB
testcase_27 AC 32 ms
7,188 KB
testcase_28 AC 33 ms
7,268 KB
testcase_29 AC 34 ms
7,348 KB
testcase_30 AC 25 ms
6,824 KB
testcase_31 AC 21 ms
6,376 KB
testcase_32 AC 20 ms
6,060 KB
testcase_33 AC 23 ms
6,780 KB
testcase_34 AC 21 ms
6,328 KB
testcase_35 AC 1 ms
4,384 KB
testcase_36 AC 2 ms
4,384 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 2 ms
4,384 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 2 ms
4,380 KB
testcase_44 AC 2 ms
4,380 KB
testcase_45 AC 2 ms
4,380 KB
testcase_46 AC 2 ms
4,380 KB
testcase_47 AC 2 ms
4,380 KB
testcase_48 AC 2 ms
4,388 KB
testcase_49 AC 2 ms
4,380 KB
testcase_50 AC 178 ms
26,796 KB
testcase_51 AC 178 ms
26,780 KB
testcase_52 AC 179 ms
26,792 KB
testcase_53 AC 173 ms
26,724 KB
testcase_54 AC 173 ms
26,784 KB
testcase_55 AC 174 ms
26,580 KB
testcase_56 AC 171 ms
25,364 KB
testcase_57 AC 156 ms
24,060 KB
testcase_58 AC 179 ms
26,772 KB
testcase_59 AC 179 ms
26,756 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