結果

問題 No.1267 Stop and Coin Game
ユーザー tyawanmusityawanmusi
提出日時 2020-10-23 22:22:40
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 503 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 85,500 KB
最終ジャッジ日時 2023-09-28 16:17:29
合計ジャッジ時間 8,990 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,248 KB
testcase_01 AC 74 ms
71,164 KB
testcase_02 AC 73 ms
71,520 KB
testcase_03 AC 78 ms
71,500 KB
testcase_04 AC 74 ms
71,592 KB
testcase_05 AC 88 ms
76,564 KB
testcase_06 AC 83 ms
76,068 KB
testcase_07 AC 74 ms
71,036 KB
testcase_08 AC 120 ms
77,532 KB
testcase_09 AC 79 ms
76,436 KB
testcase_10 AC 419 ms
85,304 KB
testcase_11 AC 174 ms
79,292 KB
testcase_12 AC 102 ms
76,796 KB
testcase_13 AC 74 ms
71,296 KB
testcase_14 AC 72 ms
71,436 KB
testcase_15 AC 84 ms
76,784 KB
testcase_16 AC 452 ms
85,500 KB
testcase_17 AC 75 ms
71,384 KB
testcase_18 AC 89 ms
76,572 KB
testcase_19 AC 76 ms
71,380 KB
testcase_20 AC 83 ms
76,336 KB
testcase_21 AC 76 ms
71,236 KB
testcase_22 AC 92 ms
76,576 KB
testcase_23 AC 76 ms
71,428 KB
testcase_24 AC 217 ms
81,220 KB
testcase_25 AC 333 ms
81,128 KB
testcase_26 AC 75 ms
71,036 KB
testcase_27 AC 97 ms
77,016 KB
testcase_28 AC 75 ms
71,488 KB
testcase_29 AC 91 ms
76,596 KB
testcase_30 AC 386 ms
85,360 KB
testcase_31 AC 90 ms
76,736 KB
testcase_32 AC 105 ms
77,560 KB
testcase_33 AC 218 ms
81,076 KB
testcase_34 AC 295 ms
80,956 KB
testcase_35 AC 368 ms
85,412 KB
testcase_36 AC 71 ms
71,400 KB
testcase_37 AC 140 ms
77,996 KB
testcase_38 AC 503 ms
85,308 KB
testcase_39 AC 111 ms
77,180 KB
testcase_40 AC 72 ms
71,312 KB
testcase_41 AC 116 ms
77,016 KB
testcase_42 AC 72 ms
71,340 KB
testcase_43 AC 142 ms
78,024 KB
testcase_44 AC 75 ms
71,432 KB
testcase_45 AC 73 ms
71,380 KB
testcase_46 AC 74 ms
71,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,v=map(int,input().split())
a=list(map(int,input().split()))
if sum(a)<=v:
  exit(print("Draw"))
dp=[True]*(1<<n)
for i in range((1<<n)-1,-1,-1):
  s=0
  for j in range(n):
    if i&(1<<j):
      s+=a[j]
  if s>v:
    dp[i]=(True)
  else:
    flag=False
    for j in range(n):
      if i&(1<<j)==0:
        if dp[i|(1<<j)]==False:
          flag=True
    dp[i]=flag
if dp[0]:
  print("First")
else:
  print("Second")
0