結果
問題 | No.1267 Stop and Coin Game |
ユーザー |
![]() |
提出日時 | 2020-10-23 22:19:40 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 799 ms / 2,000 ms |
コード長 | 830 bytes |
コンパイル時間 | 319 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 84,736 KB |
最終ジャッジ日時 | 2024-07-21 10:58:24 |
合計ジャッジ時間 | 8,176 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
mod = 1000000007eps = 10**-9def main():import sysinput = sys.stdin.readlinedef mex(L):L = set(L)for i in range(21):if i not in L:return iN, V = map(int, input().split())A = list(map(int, input().split()))if V >= sum(A):print("Draw")exit()g = [0] * (1 << N)for i in range((1 << N) - 1, -1, -1):s = 0for j in range(N):if i >> j & 1:s += A[j]if s < V:L = []for j in range(N):if i >> j & 1 == 0:if s + A[j] <= V:L.append(g[i | (1 << j)])g[i] = mex(L)if g[0]:print("First")else:print("Second")if __name__ == '__main__':main()