結果

問題 No.715 集合と二人ゲーム
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2018-07-15 11:43:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,335 bytes
コンパイル時間 1,814 ms
コンパイル使用メモリ 172,616 KB
実行使用メモリ 7,576 KB
最終ジャッジ日時 2023-08-05 18:23:51
合計ジャッジ時間 5,738 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,332 KB
testcase_01 AC 3 ms
5,520 KB
testcase_02 WA -
testcase_03 AC 4 ms
5,416 KB
testcase_04 WA -
testcase_05 AC 5 ms
5,692 KB
testcase_06 WA -
testcase_07 AC 5 ms
5,472 KB
testcase_08 WA -
testcase_09 AC 6 ms
5,424 KB
testcase_10 WA -
testcase_11 AC 6 ms
5,564 KB
testcase_12 AC 6 ms
5,508 KB
testcase_13 AC 7 ms
5,464 KB
testcase_14 WA -
testcase_15 AC 8 ms
5,556 KB
testcase_16 WA -
testcase_17 AC 8 ms
5,672 KB
testcase_18 WA -
testcase_19 AC 9 ms
5,540 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 9 ms
5,852 KB
testcase_24 AC 11 ms
5,612 KB
testcase_25 AC 11 ms
5,732 KB
testcase_26 WA -
testcase_27 AC 12 ms
5,688 KB
testcase_28 AC 12 ms
5,712 KB
testcase_29 AC 12 ms
5,660 KB
testcase_30 AC 11 ms
5,664 KB
testcase_31 AC 10 ms
5,752 KB
testcase_32 AC 10 ms
5,676 KB
testcase_33 AC 11 ms
5,608 KB
testcase_34 AC 10 ms
5,620 KB
testcase_35 AC 3 ms
5,368 KB
testcase_36 AC 3 ms
5,316 KB
testcase_37 AC 3 ms
5,332 KB
testcase_38 AC 4 ms
5,316 KB
testcase_39 AC 3 ms
5,312 KB
testcase_40 WA -
testcase_41 AC 4 ms
5,336 KB
testcase_42 AC 3 ms
5,336 KB
testcase_43 AC 3 ms
5,372 KB
testcase_44 AC 3 ms
5,388 KB
testcase_45 AC 3 ms
5,332 KB
testcase_46 AC 3 ms
5,396 KB
testcase_47 AC 3 ms
5,380 KB
testcase_48 AC 3 ms
5,328 KB
testcase_49 AC 3 ms
5,456 KB
testcase_50 WA -
testcase_51 AC 58 ms
7,340 KB
testcase_52 WA -
testcase_53 AC 55 ms
7,324 KB
testcase_54 AC 57 ms
7,328 KB
testcase_55 AC 57 ms
7,268 KB
testcase_56 WA -
testcase_57 AC 52 ms
7,100 KB
testcase_58 WA -
testcase_59 AC 57 ms
7,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/




int N, A[501010];
//---------------------------------------------------------------------------------------------------
int memo[501010];
int g(int x) {
    if (34 <= x) return g(x % 34);
    if (0 <= memo[x]) return memo[x];

    if (x == 0) return memo[x] = 0;
    if (x <= 2) return memo[x] = 1;

    set<int> gr;
    gr.insert(g(x - 2));
    gr.insert(g(x - 3));

    if (5 <= x) {
        rep(i, 1, x) {
            int j = x - i - 3;
            if (1 <= j) gr.insert(g(i) ^ g(j));
        }
    }

    int res = 0;
    while (gr.count(res)) res++;
    return memo[x] = res;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];
    sort(A, A + N);

    rep(i, 0, 501010) memo[i] = -1;
    //rep(i, 0, 1010) printf("%d : %d\n", i, g(i));
    
    int L = 0;
    int gr = 0;
    while (L < N) {
        int i = L + 1;
        while (i < N and A[i] <= A[i - 1] + 1) i++;

        int len = A[i - 1] - A[L] + 1;
        gr ^= g(len);
        L = i;
    }

    if (gr == 0) printf("Second\n");
    else printf("First\n");
    
}
0