結果
問題 | No.1267 Stop and Coin Game |
ユーザー |
![]() |
提出日時 | 2025-03-24 06:33:00 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 511 bytes |
コンパイル時間 | 445 ms |
コンパイル使用メモリ | 82,256 KB |
実行使用メモリ | 92,296 KB |
最終ジャッジ日時 | 2025-03-24 06:33:10 |
合計ジャッジ時間 | 10,209 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 29 TLE * 2 -- * 12 |
ソースコード
N, V = map(int, input().split()) A = list(map(int, input().split())) memo = {} def f(v, used) -> bool: if (v, used) in memo: return memo[v, used] win = False for i in range(N): if used & (1 << i): continue if v - A[i] < 0: continue nu = used | (1 << i) win = not f(v - A[i], nu) if win: return True memo[v, used] = win return win if sum(A) <= V: print('Draw') exit(0) win = f(V, 0) if win: print('First') else: print('Second')