結果

問題 No.715 集合と二人ゲーム
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2018-07-15 11:36:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,296 bytes
コンパイル時間 1,767 ms
コンパイル使用メモリ 172,076 KB
実行使用メモリ 5,520 KB
最終ジャッジ日時 2023-08-05 18:13:49
合計ジャッジ時間 6,378 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,376 KB
testcase_02 AC 5 ms
4,376 KB
testcase_03 AC 9 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 11 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 11 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 9 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 13 ms
4,380 KB
testcase_12 WA -
testcase_13 AC 14 ms
4,376 KB
testcase_14 WA -
testcase_15 AC 12 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 11 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 12 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 12 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 14 ms
4,384 KB
testcase_24 WA -
testcase_25 AC 14 ms
4,380 KB
testcase_26 WA -
testcase_27 AC 13 ms
4,376 KB
testcase_28 WA -
testcase_29 AC 14 ms
4,376 KB
testcase_30 WA -
testcase_31 AC 9 ms
4,380 KB
testcase_32 WA -
testcase_33 AC 9 ms
4,376 KB
testcase_34 WA -
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 2 ms
4,376 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,376 KB
testcase_46 AC 2 ms
4,376 KB
testcase_47 AC 2 ms
4,380 KB
testcase_48 AC 2 ms
4,380 KB
testcase_49 AC 2 ms
4,380 KB
testcase_50 WA -
testcase_51 AC 56 ms
5,384 KB
testcase_52 WA -
testcase_53 AC 55 ms
5,424 KB
testcase_54 WA -
testcase_55 AC 55 ms
5,380 KB
testcase_56 WA -
testcase_57 AC 52 ms
5,140 KB
testcase_58 WA -
testcase_59 AC 57 ms
5,376 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 (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