結果

問題 No.1267 Stop and Coin Game
ユーザー brthyyjpbrthyyjp
提出日時 2021-04-06 01:53:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 668 ms / 2,000 ms
コード長 619 bytes
コンパイル時間 727 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 93,728 KB
最終ジャッジ日時 2023-08-30 14:41:17
合計ジャッジ時間 10,866 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,144 KB
testcase_01 AC 73 ms
71,344 KB
testcase_02 AC 73 ms
71,444 KB
testcase_03 AC 71 ms
71,332 KB
testcase_04 AC 72 ms
71,448 KB
testcase_05 AC 83 ms
76,300 KB
testcase_06 AC 80 ms
76,272 KB
testcase_07 AC 71 ms
71,292 KB
testcase_08 AC 119 ms
79,112 KB
testcase_09 AC 77 ms
76,140 KB
testcase_10 AC 523 ms
93,560 KB
testcase_11 AC 189 ms
81,524 KB
testcase_12 AC 103 ms
77,076 KB
testcase_13 AC 74 ms
71,064 KB
testcase_14 AC 73 ms
71,444 KB
testcase_15 AC 87 ms
76,516 KB
testcase_16 AC 625 ms
93,460 KB
testcase_17 AC 74 ms
71,400 KB
testcase_18 AC 89 ms
76,628 KB
testcase_19 AC 73 ms
71,540 KB
testcase_20 AC 81 ms
76,412 KB
testcase_21 AC 72 ms
71,340 KB
testcase_22 AC 88 ms
76,704 KB
testcase_23 AC 71 ms
71,308 KB
testcase_24 AC 210 ms
85,460 KB
testcase_25 AC 324 ms
85,424 KB
testcase_26 AC 80 ms
76,536 KB
testcase_27 AC 89 ms
77,068 KB
testcase_28 AC 82 ms
76,684 KB
testcase_29 AC 88 ms
76,720 KB
testcase_30 AC 468 ms
93,728 KB
testcase_31 AC 95 ms
76,732 KB
testcase_32 AC 107 ms
78,428 KB
testcase_33 AC 198 ms
85,256 KB
testcase_34 AC 287 ms
85,448 KB
testcase_35 AC 463 ms
93,092 KB
testcase_36 AC 80 ms
76,428 KB
testcase_37 AC 142 ms
79,228 KB
testcase_38 AC 668 ms
93,644 KB
testcase_39 AC 122 ms
77,776 KB
testcase_40 AC 81 ms
76,268 KB
testcase_41 AC 123 ms
77,404 KB
testcase_42 AC 79 ms
76,508 KB
testcase_43 AC 150 ms
79,132 KB
testcase_44 AC 436 ms
93,288 KB
testcase_45 AC 74 ms
71,204 KB
testcase_46 AC 73 ms
71,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, v = map(int, input().split())
A = list(map(int, input().split()))
X = [0]*(1<<n)
for i in range(1<<n):
    s = 0
    for j in range(n):
        if (i>>j)& 1:
            s += A[j]
    X[i] = v-s
dp = [False]*(1<<n)
#print(X)
if X[-1] < 0:
    dp[-1] = True
else:
    print('Draw')
    exit()
for s in reversed(range(2**n-1)):
    if X[s] < 0:
        dp[s] = True
        continue
    v = True
    for j in range(n):
        if not ((s>>j) & 1):
            ns = s | (1<<j)
            v &= dp[ns]
    if v:
        dp[s] = False
    else:
        dp[s] = True
if dp[0]:
    print('First')
else:
    print('Second')
0