結果

問題 No.1267 Stop and Coin Game
ユーザー sotanishysotanishy
提出日時 2020-10-23 22:59:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,146 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 87,968 KB
最終ジャッジ日時 2023-09-28 17:29:21
合計ジャッジ時間 14,202 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,460 KB
testcase_01 AC 82 ms
71,448 KB
testcase_02 AC 75 ms
71,312 KB
testcase_03 AC 78 ms
71,228 KB
testcase_04 AC 79 ms
71,128 KB
testcase_05 AC 125 ms
78,124 KB
testcase_06 AC 90 ms
75,964 KB
testcase_07 AC 75 ms
71,276 KB
testcase_08 AC 283 ms
79,436 KB
testcase_09 AC 81 ms
75,900 KB
testcase_10 AC 909 ms
87,968 KB
testcase_11 AC 423 ms
81,756 KB
testcase_12 AC 236 ms
79,264 KB
testcase_13 AC 76 ms
71,312 KB
testcase_14 AC 77 ms
71,260 KB
testcase_15 AC 91 ms
75,972 KB
testcase_16 AC 1,002 ms
87,636 KB
testcase_17 AC 75 ms
71,216 KB
testcase_18 AC 161 ms
78,000 KB
testcase_19 AC 79 ms
71,128 KB
testcase_20 AC 89 ms
76,016 KB
testcase_21 AC 76 ms
71,400 KB
testcase_22 AC 159 ms
78,204 KB
testcase_23 AC 76 ms
71,244 KB
testcase_24 AC 500 ms
82,492 KB
testcase_25 AC 703 ms
83,248 KB
testcase_26 AC 76 ms
71,316 KB
testcase_27 AC 145 ms
77,944 KB
testcase_28 AC 75 ms
71,236 KB
testcase_29 AC 129 ms
77,564 KB
testcase_30 AC 757 ms
86,812 KB
testcase_31 AC 187 ms
78,576 KB
testcase_32 AC 222 ms
78,980 KB
testcase_33 AC 405 ms
81,984 KB
testcase_34 AC 613 ms
83,100 KB
testcase_35 AC 711 ms
86,348 KB
testcase_36 AC 76 ms
71,272 KB
testcase_37 AC 325 ms
79,520 KB
testcase_38 AC 1,146 ms
87,888 KB
testcase_39 AC 269 ms
79,104 KB
testcase_40 AC 75 ms
71,240 KB
testcase_41 AC 246 ms
79,548 KB
testcase_42 AC 75 ms
71,160 KB
testcase_43 AC 336 ms
79,248 KB
testcase_44 AC 76 ms
71,260 KB
testcase_45 AC 75 ms
71,376 KB
testcase_46 AC 76 ms
71,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, V = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) <= V:
    print('Draw')
    exit()
dp = [False] * (1 << N)
for S in range(1 << N)[::-1]:
    s = sum(A[i] for i in range(N) if S >> i & 1)
    if s > V:
        dp[S] = True
    else:
        dp[S] = any(not dp[S | 1 << i] for i in range(N) if not (S >> i & 1))
print('First' if dp[0] else 'Second')

0