結果

問題 No.1267 Stop and Coin Game
ユーザー mlihua09mlihua09
提出日時 2020-10-23 22:49:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,328 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 934 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 85,724 KB
最終ジャッジ日時 2023-09-28 17:11:43
合計ジャッジ時間 15,671 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,432 KB
testcase_01 AC 75 ms
71,116 KB
testcase_02 AC 74 ms
71,364 KB
testcase_03 AC 77 ms
71,368 KB
testcase_04 AC 79 ms
74,996 KB
testcase_05 AC 108 ms
76,864 KB
testcase_06 AC 87 ms
75,992 KB
testcase_07 AC 74 ms
71,368 KB
testcase_08 AC 221 ms
78,488 KB
testcase_09 AC 80 ms
75,224 KB
testcase_10 AC 1,159 ms
85,616 KB
testcase_11 AC 381 ms
79,576 KB
testcase_12 AC 152 ms
77,868 KB
testcase_13 AC 74 ms
71,260 KB
testcase_14 AC 73 ms
71,560 KB
testcase_15 AC 87 ms
75,940 KB
testcase_16 AC 1,268 ms
85,632 KB
testcase_17 AC 77 ms
71,368 KB
testcase_18 AC 121 ms
77,664 KB
testcase_19 AC 73 ms
71,468 KB
testcase_20 AC 86 ms
75,896 KB
testcase_21 AC 77 ms
71,364 KB
testcase_22 AC 116 ms
77,760 KB
testcase_23 AC 75 ms
71,328 KB
testcase_24 AC 567 ms
81,472 KB
testcase_25 AC 707 ms
81,776 KB
testcase_26 AC 75 ms
71,320 KB
testcase_27 AC 123 ms
77,320 KB
testcase_28 AC 72 ms
71,176 KB
testcase_29 AC 109 ms
77,444 KB
testcase_30 AC 1,026 ms
85,556 KB
testcase_31 AC 122 ms
77,468 KB
testcase_32 AC 206 ms
78,092 KB
testcase_33 AC 554 ms
81,372 KB
testcase_34 AC 714 ms
81,516 KB
testcase_35 AC 1,020 ms
85,476 KB
testcase_36 AC 75 ms
71,228 KB
testcase_37 AC 254 ms
78,484 KB
testcase_38 AC 1,328 ms
85,724 KB
testcase_39 AC 181 ms
77,968 KB
testcase_40 AC 74 ms
71,284 KB
testcase_41 AC 182 ms
78,292 KB
testcase_42 AC 73 ms
71,120 KB
testcase_43 AC 246 ms
79,052 KB
testcase_44 AC 75 ms
71,376 KB
testcase_45 AC 75 ms
71,184 KB
testcase_46 AC 73 ms
71,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, V = map(int, input().split())

A = list(map(int, input().split()))

a = sum(A)

if a <= V:
    print('Draw')
    exit()
    
DP = [0] * 2 ** N

from itertools import combinations

for i in range(0, N + 1):
    
    for Iter in combinations(range(N), r=i):
        
        x = sum([A[j] for j in Iter] + [0])
        
        y = sum([2 ** j for j in Iter] + [0])
        
        if a - x > V:
            
            DP[y] = 1
            
        else:
            
            if any(DP[y - 2 ** j] == 0 for j in Iter):
                
                DP[y] = 1
                
if DP[-1]:
    
    print('First')
    
else:
    
    print('Second')
0