結果

問題 No.715 集合と二人ゲーム
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2018-07-15 11:47:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 2,343 bytes
コンパイル時間 1,884 ms
コンパイル使用メモリ 171,804 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-23 15:12:39
合計ジャッジ時間 4,822 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 3 ms
6,940 KB
testcase_02 AC 5 ms
6,944 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 11 ms
6,944 KB
testcase_05 AC 11 ms
6,940 KB
testcase_06 AC 12 ms
6,940 KB
testcase_07 AC 12 ms
6,940 KB
testcase_08 AC 11 ms
6,944 KB
testcase_09 AC 10 ms
6,944 KB
testcase_10 AC 12 ms
6,944 KB
testcase_11 AC 13 ms
6,940 KB
testcase_12 AC 13 ms
6,940 KB
testcase_13 AC 13 ms
6,944 KB
testcase_14 AC 13 ms
6,944 KB
testcase_15 AC 12 ms
6,940 KB
testcase_16 AC 12 ms
6,944 KB
testcase_17 AC 12 ms
6,940 KB
testcase_18 AC 14 ms
6,940 KB
testcase_19 AC 12 ms
6,940 KB
testcase_20 AC 15 ms
6,944 KB
testcase_21 AC 13 ms
6,940 KB
testcase_22 AC 14 ms
6,944 KB
testcase_23 AC 15 ms
6,940 KB
testcase_24 AC 17 ms
6,944 KB
testcase_25 AC 15 ms
6,940 KB
testcase_26 AC 15 ms
6,940 KB
testcase_27 AC 14 ms
6,944 KB
testcase_28 AC 13 ms
6,940 KB
testcase_29 AC 15 ms
6,940 KB
testcase_30 AC 12 ms
6,940 KB
testcase_31 AC 12 ms
6,940 KB
testcase_32 AC 11 ms
6,940 KB
testcase_33 AC 12 ms
6,940 KB
testcase_34 AC 11 ms
6,940 KB
testcase_35 AC 2 ms
6,940 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 2 ms
6,944 KB
testcase_38 AC 2 ms
6,940 KB
testcase_39 AC 2 ms
6,944 KB
testcase_40 AC 2 ms
6,944 KB
testcase_41 AC 2 ms
6,944 KB
testcase_42 AC 2 ms
6,944 KB
testcase_43 AC 2 ms
6,944 KB
testcase_44 AC 3 ms
6,940 KB
testcase_45 AC 2 ms
6,940 KB
testcase_46 AC 2 ms
6,944 KB
testcase_47 AC 3 ms
6,944 KB
testcase_48 AC 2 ms
6,944 KB
testcase_49 AC 3 ms
6,940 KB
testcase_50 AC 66 ms
6,944 KB
testcase_51 AC 62 ms
6,940 KB
testcase_52 AC 64 ms
6,948 KB
testcase_53 AC 61 ms
6,940 KB
testcase_54 AC 64 ms
6,944 KB
testcase_55 AC 62 ms
6,940 KB
testcase_56 AC 61 ms
6,940 KB
testcase_57 AC 56 ms
6,940 KB
testcase_58 AC 64 ms
6,944 KB
testcase_59 AC 64 ms
6,940 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[1010];
int g(int x) {
    if (1010 <= x) return g(34 * 10 + 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, 1010) 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