結果

問題 No.715 集合と二人ゲーム
ユーザー vwxyzvwxyz
提出日時 2022-08-10 19:29:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 439 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 68,492 KB
最終ジャッジ日時 2023-10-21 04:51:24
合計ジャッジ時間 20,184 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 182 ms
10,000 KB
testcase_01 AC 180 ms
10,376 KB
testcase_02 AC 194 ms
10,712 KB
testcase_03 AC 188 ms
11,012 KB
testcase_04 AC 183 ms
11,364 KB
testcase_05 AC 186 ms
11,620 KB
testcase_06 AC 199 ms
11,872 KB
testcase_07 AC 199 ms
12,392 KB
testcase_08 AC 191 ms
12,324 KB
testcase_09 AC 191 ms
12,920 KB
testcase_10 AC 194 ms
13,264 KB
testcase_11 AC 203 ms
13,444 KB
testcase_12 AC 210 ms
13,628 KB
testcase_13 AC 195 ms
14,236 KB
testcase_14 AC 201 ms
14,388 KB
testcase_15 AC 196 ms
14,900 KB
testcase_16 AC 205 ms
15,280 KB
testcase_17 AC 201 ms
15,204 KB
testcase_18 AC 204 ms
15,716 KB
testcase_19 AC 216 ms
15,720 KB
testcase_20 AC 222 ms
16,444 KB
testcase_21 AC 211 ms
16,644 KB
testcase_22 AC 211 ms
17,476 KB
testcase_23 AC 222 ms
17,396 KB
testcase_24 AC 232 ms
17,792 KB
testcase_25 AC 220 ms
18,224 KB
testcase_26 AC 223 ms
17,808 KB
testcase_27 AC 234 ms
18,724 KB
testcase_28 AC 220 ms
18,920 KB
testcase_29 AC 225 ms
19,300 KB
testcase_30 AC 219 ms
17,940 KB
testcase_31 AC 212 ms
17,404 KB
testcase_32 AC 209 ms
16,652 KB
testcase_33 AC 220 ms
18,416 KB
testcase_34 AC 210 ms
16,820 KB
testcase_35 AC 196 ms
9,996 KB
testcase_36 AC 177 ms
9,996 KB
testcase_37 AC 183 ms
9,996 KB
testcase_38 AC 188 ms
10,060 KB
testcase_39 AC 183 ms
9,996 KB
testcase_40 AC 178 ms
10,180 KB
testcase_41 AC 189 ms
10,180 KB
testcase_42 AC 179 ms
10,180 KB
testcase_43 AC 186 ms
10,184 KB
testcase_44 AC 183 ms
10,180 KB
testcase_45 AC 177 ms
10,184 KB
testcase_46 AC 177 ms
10,180 KB
testcase_47 AC 180 ms
10,180 KB
testcase_48 AC 177 ms
10,184 KB
testcase_49 AC 180 ms
10,180 KB
testcase_50 AC 432 ms
68,472 KB
testcase_51 AC 438 ms
68,468 KB
testcase_52 AC 435 ms
68,468 KB
testcase_53 AC 426 ms
68,340 KB
testcase_54 AC 436 ms
68,492 KB
testcase_55 AC 426 ms
68,128 KB
testcase_56 AC 412 ms
65,256 KB
testcase_57 AC 396 ms
58,460 KB
testcase_58 AC 436 ms
68,472 KB
testcase_59 AC 439 ms
68,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from functools import lru_cache
import sys
readline=sys.stdin.readline
sys.setrecursionlimit(10**5)

N=int(readline())
A=sorted(list(map(int,readline().split())))
bound=[0]
for i in range(1,N):
    if A[i]-A[i-1]>=2:
        bound.append(i)
bound.append(N)
le=len(bound)
grundy=[0]*1001
grundy[1]=1
for i in range(2,1000):
    dct=defaultdict(int)
    dct[grundy[i-2]]=2
    for j in range(i-2):
        dct[grundy[j]^grundy[i-j-3]]+=1
    g=0
    while g in dct:
        g+=1
    grundy[i]=g
g=0
for i in range(le-1):
    x=bound[i+1]-bound[i]
    if x>=900:
        x-=900
        x%=34
        x+=900
    g^=grundy[x]
if g:
    ans="First"
else:
    ans="Second"
print(ans)
0