結果
問題 |
No.1267 Stop and Coin Game
|
ユーザー |
![]() |
提出日時 | 2021-04-06 01:53:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 655 ms / 2,000 ms |
コード長 | 619 bytes |
コンパイル時間 | 334 ms |
コンパイル使用メモリ | 82,392 KB |
実行使用メモリ | 92,872 KB |
最終ジャッジ日時 | 2025-01-02 05:41:06 |
合計ジャッジ時間 | 8,316 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
n, v = map(int, input().split()) A = list(map(int, input().split())) X = [0]*(1<<n) for i in range(1<<n): s = 0 for j in range(n): if (i>>j)& 1: s += A[j] X[i] = v-s dp = [False]*(1<<n) #print(X) if X[-1] < 0: dp[-1] = True else: print('Draw') exit() for s in reversed(range(2**n-1)): if X[s] < 0: dp[s] = True continue v = True for j in range(n): if not ((s>>j) & 1): ns = s | (1<<j) v &= dp[ns] if v: dp[s] = False else: dp[s] = True if dp[0]: print('First') else: print('Second')