結果
問題 |
No.1267 Stop and Coin Game
|
ユーザー |
|
提出日時 | 2020-10-31 17:42:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 120 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 24,192 KB |
最終ジャッジ日時 | 2024-07-22 05:06:02 |
合計ジャッジ時間 | 4,682 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 6 TLE * 1 -- * 36 |
ソースコード
n,v = map(int,input().split()) a = list(map(int,input().split())) if sum(a) <= v: print("Draw") exit() dp = [1]*(1<<n) for i in range(2**n-1,-1,-1): s = 0 for j in range(n): if i >> j & 1: s += a[j] if s > v: continue check = 0 for j in range(n): if i >> j & 1: continue if dp[i|1<<j] == 0: check = 1 dp[i] = check if dp[0]: print("First") else: print("Second")