結果

問題 No.715 集合と二人ゲーム
ユーザー mkawa2mkawa2
提出日時 2022-01-25 16:26:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 290 ms / 2,000 ms
コード長 1,356 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,988 KB
実行使用メモリ 66,692 KB
最終ジャッジ日時 2023-08-22 10:52:11
合計ジャッジ時間 8,108 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,068 KB
testcase_01 AC 18 ms
8,664 KB
testcase_02 AC 19 ms
9,016 KB
testcase_03 AC 21 ms
9,376 KB
testcase_04 AC 22 ms
9,612 KB
testcase_05 AC 25 ms
10,080 KB
testcase_06 AC 25 ms
10,256 KB
testcase_07 AC 27 ms
10,444 KB
testcase_08 AC 28 ms
10,696 KB
testcase_09 AC 30 ms
11,148 KB
testcase_10 AC 30 ms
11,312 KB
testcase_11 AC 33 ms
11,828 KB
testcase_12 AC 33 ms
12,080 KB
testcase_13 AC 36 ms
12,380 KB
testcase_14 AC 38 ms
12,976 KB
testcase_15 AC 39 ms
12,940 KB
testcase_16 AC 41 ms
13,692 KB
testcase_17 AC 40 ms
13,492 KB
testcase_18 AC 44 ms
14,156 KB
testcase_19 AC 45 ms
14,056 KB
testcase_20 AC 47 ms
14,804 KB
testcase_21 AC 49 ms
15,064 KB
testcase_22 AC 50 ms
15,524 KB
testcase_23 AC 50 ms
15,420 KB
testcase_24 AC 54 ms
16,104 KB
testcase_25 AC 55 ms
16,100 KB
testcase_26 AC 53 ms
16,168 KB
testcase_27 AC 60 ms
17,104 KB
testcase_28 AC 63 ms
17,216 KB
testcase_29 AC 62 ms
17,616 KB
testcase_30 AC 57 ms
16,364 KB
testcase_31 AC 51 ms
15,332 KB
testcase_32 AC 49 ms
14,712 KB
testcase_33 AC 57 ms
16,204 KB
testcase_34 AC 49 ms
14,776 KB
testcase_35 AC 16 ms
8,160 KB
testcase_36 AC 15 ms
8,072 KB
testcase_37 AC 16 ms
8,224 KB
testcase_38 AC 16 ms
8,012 KB
testcase_39 AC 16 ms
8,088 KB
testcase_40 AC 17 ms
8,064 KB
testcase_41 AC 17 ms
8,100 KB
testcase_42 AC 17 ms
8,120 KB
testcase_43 AC 16 ms
8,080 KB
testcase_44 AC 17 ms
8,244 KB
testcase_45 AC 17 ms
8,064 KB
testcase_46 AC 17 ms
8,140 KB
testcase_47 AC 16 ms
8,124 KB
testcase_48 AC 16 ms
8,092 KB
testcase_49 AC 16 ms
8,084 KB
testcase_50 AC 286 ms
66,692 KB
testcase_51 AC 290 ms
66,588 KB
testcase_52 AC 280 ms
66,564 KB
testcase_53 AC 280 ms
66,464 KB
testcase_54 AC 279 ms
66,612 KB
testcase_55 AC 279 ms
66,084 KB
testcase_56 AC 263 ms
63,376 KB
testcase_57 AC 264 ms
56,444 KB
testcase_58 AC 286 ms
66,688 KB
testcase_59 AC 287 ms
66,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = 18446744073709551615
inf = 4294967295
# md = 10**9+7
md = 998244353

pre = [0, 1, 1, 2, 0, 3, 1, 1, 0, 3, 3, 2, 2, 4, 0, 5, 2, 2, 3, 3, 0, 1, 1, 3, 0, 2, 1, 1, 0, 4, 5, 2, 7, 4, 0, 1, 1, 2,
       0, 3, 1, 1, 0, 3, 3, 2, 2, 4, 4, 5, 5, 2]
gg = [3, 3, 0, 1, 1, 3, 0, 2, 1, 1, 0, 4, 5, 3, 7, 4, 8, 1, 1, 2, 0, 3, 1, 1, 0, 3, 3, 2, 2, 4, 4, 5, 5, 9]

def grundy(a):
    if a < 52: return pre[a]
    return gg[(a-52)%34]

n = II()
aa = LI()

aa.sort()
ss = []
pa = aa[0]
cnt = 1
x = 0
for a in aa[1:]:
    if a == pa+1:
        cnt += 1
    else:
        x ^= grundy(cnt)
        # pDB(cnt)
        cnt = 1
    pa = a
# pDB(cnt)
x ^= grundy(cnt)

# pDB("x=",x)
print("First" if x else "Second")
0