結果
問題 | No.1267 Stop and Coin Game |
ユーザー |
|
提出日時 | 2022-02-19 16:07:58 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 654 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 92,544 KB |
最終ジャッジ日時 | 2024-06-29 10:26:54 |
合計ジャッジ時間 | 4,436 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 6 TLE * 1 -- * 36 |
ソースコード
N,V = map(int,input().split())A = list(map(int,input().split()))S = sum(A)import sysif 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 << iif bit & mask:dat[bit] = A[i] + dat[bit ^ mask]breakfrom functools import lru_cache@lru_cachedef calc(S = 0):#flag = S.count('1')for i in range(N):mask = 1 << iif S & mask:continueif dat[S | mask] > V:continuea = calc(S | mask)if a == False:return Truereturn Falseprint('First' if calc() else "Second")