結果

問題 No.715 集合と二人ゲーム
ユーザー maspymaspy
提出日時 2020-03-31 15:00:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 414 ms / 2,000 ms
コード長 974 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 58,216 KB
最終ジャッジ日時 2023-09-06 22:24:36
合計ジャッジ時間 16,165 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 167 ms
8,652 KB
testcase_01 AC 167 ms
8,848 KB
testcase_02 AC 169 ms
9,204 KB
testcase_03 AC 170 ms
9,472 KB
testcase_04 AC 171 ms
9,804 KB
testcase_05 AC 173 ms
10,028 KB
testcase_06 AC 175 ms
10,176 KB
testcase_07 AC 176 ms
10,552 KB
testcase_08 AC 177 ms
10,780 KB
testcase_09 AC 180 ms
11,004 KB
testcase_10 AC 179 ms
11,352 KB
testcase_11 AC 181 ms
11,408 KB
testcase_12 AC 182 ms
11,524 KB
testcase_13 AC 185 ms
12,320 KB
testcase_14 AC 188 ms
12,484 KB
testcase_15 AC 187 ms
12,596 KB
testcase_16 AC 190 ms
13,052 KB
testcase_17 AC 190 ms
13,092 KB
testcase_18 AC 193 ms
13,904 KB
testcase_19 AC 192 ms
13,968 KB
testcase_20 AC 195 ms
14,004 KB
testcase_21 AC 197 ms
14,356 KB
testcase_22 AC 197 ms
14,636 KB
testcase_23 AC 199 ms
14,640 KB
testcase_24 AC 202 ms
15,680 KB
testcase_25 AC 203 ms
15,720 KB
testcase_26 AC 198 ms
15,712 KB
testcase_27 AC 205 ms
15,984 KB
testcase_28 AC 204 ms
16,448 KB
testcase_29 AC 205 ms
16,540 KB
testcase_30 AC 201 ms
15,816 KB
testcase_31 AC 198 ms
14,512 KB
testcase_32 AC 197 ms
13,992 KB
testcase_33 AC 202 ms
15,872 KB
testcase_34 AC 195 ms
14,056 KB
testcase_35 AC 165 ms
8,644 KB
testcase_36 AC 169 ms
8,588 KB
testcase_37 AC 166 ms
8,688 KB
testcase_38 AC 166 ms
8,728 KB
testcase_39 AC 167 ms
8,644 KB
testcase_40 AC 168 ms
8,728 KB
testcase_41 AC 167 ms
8,728 KB
testcase_42 AC 166 ms
8,816 KB
testcase_43 AC 166 ms
8,700 KB
testcase_44 AC 168 ms
8,644 KB
testcase_45 AC 168 ms
8,720 KB
testcase_46 AC 166 ms
8,820 KB
testcase_47 AC 167 ms
8,736 KB
testcase_48 AC 167 ms
8,736 KB
testcase_49 AC 168 ms
8,820 KB
testcase_50 AC 412 ms
57,736 KB
testcase_51 AC 412 ms
57,644 KB
testcase_52 AC 402 ms
57,884 KB
testcase_53 AC 404 ms
58,216 KB
testcase_54 AC 414 ms
57,608 KB
testcase_55 AC 412 ms
57,132 KB
testcase_56 AC 396 ms
56,732 KB
testcase_57 AC 387 ms
53,944 KB
testcase_58 AC 403 ms
57,860 KB
testcase_59 AC 414 ms
57,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from functools import lru_cache


@lru_cache(None)
def G(n):
    if n == 0:
        return 0
    if n == 1:
        return 1
    if n == 2:
        return 1
    nums = []
    nums.append(G(n - 2))
    for k in range(3, n + 1):
        nums.append(G(k - 3) ^ G(n - k))
    g = 0
    nums = set(nums)
    while g in nums:
        g += 1
    return g


U = 1000
G = [G(n) for n in range(U)]

"""
from matplotlib import pyplot as plt
plt.figure(figsize=(16,4))
plt.plot(range(300), A[:300])
"""

N = int(readline())
A = sorted(map(int, read().split()))
nums = []
prev = -10
n = 0
for x in A:
    if x == prev + 1:
        n += 1
    else:
        nums.append(n)
        n = 1
    prev = x
nums.append(n)

xor = 0
for n in nums:
    if n < U:
        xor ^= G[n]
    else:
        xor ^= G[n % 34 + 340]
print('First' if xor else 'Second')
0