結果

問題 No.715 集合と二人ゲーム
ユーザー parukiparuki
提出日時 2018-07-17 12:27:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,691 bytes
コンパイル時間 2,024 ms
コンパイル使用メモリ 171,504 KB
実行使用メモリ 27,136 KB
最終ジャッジ日時 2023-08-16 06:51:45
合計ジャッジ時間 8,797 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,376 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 6 ms
4,376 KB
testcase_06 AC 7 ms
4,384 KB
testcase_07 AC 9 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 11 ms
4,672 KB
testcase_10 WA -
testcase_11 AC 13 ms
4,884 KB
testcase_12 AC 13 ms
4,932 KB
testcase_13 AC 15 ms
5,116 KB
testcase_14 AC 17 ms
5,388 KB
testcase_15 AC 17 ms
5,348 KB
testcase_16 WA -
testcase_17 AC 18 ms
5,540 KB
testcase_18 WA -
testcase_19 AC 22 ms
5,868 KB
testcase_20 WA -
testcase_21 AC 26 ms
6,380 KB
testcase_22 AC 27 ms
6,492 KB
testcase_23 AC 26 ms
6,396 KB
testcase_24 WA -
testcase_25 AC 30 ms
6,708 KB
testcase_26 WA -
testcase_27 AC 33 ms
7,172 KB
testcase_28 AC 34 ms
7,424 KB
testcase_29 AC 35 ms
7,360 KB
testcase_30 AC 26 ms
6,876 KB
testcase_31 AC 22 ms
6,356 KB
testcase_32 AC 21 ms
6,140 KB
testcase_33 AC 25 ms
6,812 KB
testcase_34 AC 21 ms
6,192 KB
testcase_35 AC 2 ms
4,384 KB
testcase_36 AC 2 ms
4,384 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 2 ms
4,384 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 2 ms
4,376 KB
testcase_43 AC 2 ms
4,380 KB
testcase_44 AC 2 ms
4,384 KB
testcase_45 AC 2 ms
4,376 KB
testcase_46 AC 2 ms
4,376 KB
testcase_47 AC 2 ms
4,380 KB
testcase_48 AC 2 ms
4,376 KB
testcase_49 AC 2 ms
4,380 KB
testcase_50 WA -
testcase_51 AC 191 ms
26,824 KB
testcase_52 AC 190 ms
26,816 KB
testcase_53 AC 186 ms
26,804 KB
testcase_54 WA -
testcase_55 AC 182 ms
26,576 KB
testcase_56 WA -
testcase_57 AC 163 ms
23,928 KB
testcase_58 WA -
testcase_59 AC 188 ms
26,848 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[88];
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, 84)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