結果
| 問題 |
No.1267 Stop and Coin Game
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-03-24 06:33:52 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 511 bytes |
| コンパイル時間 | 330 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 21,128 KB |
| 最終ジャッジ日時 | 2025-03-24 06:34:03 |
| 合計ジャッジ時間 | 9,841 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 TLE * 2 -- * 21 |
ソースコード
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')
norioc