結果
| 問題 |
No.1267 Stop and Coin Game
|
| コンテスト | |
| ユーザー |
nagiss
|
| 提出日時 | 2020-10-23 22:50:10 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 579 bytes |
| コンパイル時間 | 96 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 25,720 KB |
| 最終ジャッジ日時 | 2024-07-21 11:55:35 |
| 合計ジャッジ時間 | 24,416 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 TLE * 5 -- * 8 |
ソースコード
def main():
N, V = map(int, input().split())
A = list(map(int, input().split()))
Win = [False] * (1<<N)
if sum(A) <= V:
print("Draw")
exit()
for s in range((1<<N)-1, -1, -1):
v = 0
for idx_A, a in enumerate(A):
if s>>idx_A&1:
v += a
if v > V:
Win[s] = win = True
else:
win = Win[s]
if not win:
for idx_A in range(N):
if s>>idx_A&1:
Win[s^1<<idx_A] = True
print("First" if win else "Second")
main()
nagiss