結果
問題 | No.1267 Stop and Coin Game |
ユーザー |
|
提出日時 | 2022-02-19 16:06:49 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 611 bytes |
コンパイル時間 | 142 ms |
コンパイル使用メモリ | 82,076 KB |
実行使用メモリ | 86,396 KB |
最終ジャッジ日時 | 2024-06-29 10:26:46 |
合計ジャッジ時間 | 4,596 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 11 TLE * 2 -- * 30 |
ソースコード
N,V = map(int,input().split()) A = list(map(int,input().split())) S = sum(A) import sys if S < V: print("Draw") exit() sys.setrecursionlimit(10 ** 8 ) dat = [0] * (1 << N) for bit in range(1,1 << N): for i in range(N): mask = 1 << i if bit & mask: dat[bit] = A[i] + dat[bit ^ mask] break def calc(S = 0): #flag = S.count('1') for i in range(N): mask = 1 << i if S & mask:continue if dat[S | mask] > V:continue a = calc(S | mask) if a == False:return True return False print('First' if calc() else "Second")