結果

問題 No.715 集合と二人ゲーム
ユーザー pekempeypekempey
提出日時 2018-07-13 22:42:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 580 ms / 2,000 ms
コード長 744 bytes
コンパイル時間 719 ms
コンパイル使用メモリ 78,332 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-04-17 11:15:13
合計ジャッジ時間 29,011 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 395 ms
5,376 KB
testcase_01 AC 395 ms
5,504 KB
testcase_02 AC 396 ms
5,504 KB
testcase_03 AC 398 ms
5,632 KB
testcase_04 AC 397 ms
5,632 KB
testcase_05 AC 399 ms
5,632 KB
testcase_06 AC 402 ms
5,632 KB
testcase_07 AC 400 ms
5,632 KB
testcase_08 AC 403 ms
5,632 KB
testcase_09 AC 405 ms
5,760 KB
testcase_10 AC 405 ms
5,632 KB
testcase_11 AC 405 ms
5,504 KB
testcase_12 AC 407 ms
5,504 KB
testcase_13 AC 407 ms
5,484 KB
testcase_14 AC 408 ms
5,616 KB
testcase_15 AC 410 ms
5,484 KB
testcase_16 AC 411 ms
5,744 KB
testcase_17 AC 410 ms
5,484 KB
testcase_18 AC 411 ms
5,488 KB
testcase_19 AC 414 ms
5,740 KB
testcase_20 AC 415 ms
5,736 KB
testcase_21 AC 417 ms
5,744 KB
testcase_22 AC 419 ms
5,612 KB
testcase_23 AC 416 ms
5,616 KB
testcase_24 AC 420 ms
5,616 KB
testcase_25 AC 419 ms
5,760 KB
testcase_26 AC 421 ms
5,632 KB
testcase_27 AC 423 ms
5,740 KB
testcase_28 AC 424 ms
5,760 KB
testcase_29 AC 425 ms
5,632 KB
testcase_30 AC 421 ms
5,760 KB
testcase_31 AC 418 ms
5,616 KB
testcase_32 AC 415 ms
5,608 KB
testcase_33 AC 418 ms
5,608 KB
testcase_34 AC 417 ms
5,740 KB
testcase_35 AC 394 ms
5,632 KB
testcase_36 AC 393 ms
5,376 KB
testcase_37 AC 393 ms
5,376 KB
testcase_38 AC 393 ms
5,632 KB
testcase_39 AC 393 ms
5,632 KB
testcase_40 AC 394 ms
5,504 KB
testcase_41 AC 394 ms
5,376 KB
testcase_42 AC 394 ms
5,504 KB
testcase_43 AC 395 ms
5,504 KB
testcase_44 AC 394 ms
5,632 KB
testcase_45 AC 396 ms
5,504 KB
testcase_46 AC 394 ms
5,632 KB
testcase_47 AC 395 ms
5,376 KB
testcase_48 AC 395 ms
5,632 KB
testcase_49 AC 395 ms
5,632 KB
testcase_50 AC 580 ms
7,296 KB
testcase_51 AC 578 ms
7,168 KB
testcase_52 AC 572 ms
7,168 KB
testcase_53 AC 570 ms
7,168 KB
testcase_54 AC 571 ms
7,296 KB
testcase_55 AC 576 ms
7,168 KB
testcase_56 AC 567 ms
7,168 KB
testcase_57 AC 556 ms
6,944 KB
testcase_58 AC 574 ms
7,168 KB
testcase_59 AC 578 ms
7,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int g[500001];

int main() {
  g[1] = 1;
  g[2] = 1;
  for (int i = 3; i <= 500000; i++) {
    long long st = 0;
    st |= 1LL << g[i - 2];
    for (int j = 0; j <= min(800, i - 3); j++) {
      st |= 1LL << (g[j] ^ g[i - 3 - j]);
    }
    while (st >> g[i] & 1) {
      g[i]++;
    }
  }
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int cnt = 1;
  int ans = 0;
  for (int i = 1; i < n; i++) {
    if (a[i - 1] + 1 == a[i]) {
      cnt++;
    } else {
      ans ^= g[cnt];
      cnt = 1;
    }
  }
  ans ^= g[cnt];
  cout << (ans != 0 ? "First" : "Second") << endl;
}
0