結果

問題 No.1267 Stop and Coin Game
ユーザー titiatitia
提出日時 2020-10-23 23:20:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 535 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 85,576 KB
最終ジャッジ日時 2023-09-28 18:33:57
合計ジャッジ時間 8,808 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,044 KB
testcase_01 AC 76 ms
71,556 KB
testcase_02 AC 77 ms
71,416 KB
testcase_03 AC 76 ms
71,292 KB
testcase_04 AC 77 ms
71,048 KB
testcase_05 AC 86 ms
76,484 KB
testcase_06 AC 82 ms
76,228 KB
testcase_07 AC 74 ms
71,480 KB
testcase_08 AC 115 ms
77,632 KB
testcase_09 AC 81 ms
76,632 KB
testcase_10 AC 485 ms
85,244 KB
testcase_11 AC 161 ms
79,032 KB
testcase_12 AC 102 ms
76,948 KB
testcase_13 AC 76 ms
71,076 KB
testcase_14 AC 77 ms
71,480 KB
testcase_15 AC 86 ms
76,604 KB
testcase_16 AC 535 ms
84,908 KB
testcase_17 AC 76 ms
71,420 KB
testcase_18 AC 92 ms
76,536 KB
testcase_19 AC 78 ms
71,452 KB
testcase_20 AC 84 ms
76,352 KB
testcase_21 AC 77 ms
71,244 KB
testcase_22 AC 93 ms
76,568 KB
testcase_23 AC 76 ms
71,252 KB
testcase_24 AC 204 ms
81,224 KB
testcase_25 AC 258 ms
80,944 KB
testcase_26 AC 77 ms
71,356 KB
testcase_27 AC 88 ms
76,796 KB
testcase_28 AC 78 ms
71,156 KB
testcase_29 AC 92 ms
76,680 KB
testcase_30 AC 455 ms
85,012 KB
testcase_31 AC 93 ms
76,588 KB
testcase_32 AC 108 ms
77,516 KB
testcase_33 AC 198 ms
81,272 KB
testcase_34 AC 241 ms
81,364 KB
testcase_35 AC 448 ms
85,284 KB
testcase_36 AC 77 ms
71,540 KB
testcase_37 AC 130 ms
77,980 KB
testcase_38 AC 529 ms
85,576 KB
testcase_39 AC 119 ms
77,120 KB
testcase_40 AC 78 ms
71,360 KB
testcase_41 AC 118 ms
77,120 KB
testcase_42 AC 76 ms
71,224 KB
testcase_43 AC 133 ms
77,988 KB
testcase_44 AC 77 ms
71,460 KB
testcase_45 AC 76 ms
71,560 KB
testcase_46 AC 77 ms
71,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,V=map(int,input().split())
A=list(map(int,input().split()))
if sum(A)<=V:
    print("Draw")
    exit()


ANS=[0]*(1<<N)

for i in range((1<<N)-1,-1,-1):
    S=0
    for j in range(N):
        if (1<<j) & i !=0:
            S+=A[j]
    #print(i,S)
    if S>V:
        ANS[i]=1

    else:
        for j in range(N):
            if (1<<j) & i == 0:
                if ANS[i|(1<<j)]==0:
                    ANS[i]=1
                    break

if ANS[0]==1:
    print("First")
else:
    print("Second")
        
    
0