結果

問題 No.1267 Stop and Coin Game
ユーザー 👑 tamatotamato
提出日時 2020-10-23 22:19:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 834 ms / 2,000 ms
コード長 830 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 85,960 KB
最終ジャッジ日時 2023-09-28 16:14:15
合計ジャッジ時間 10,265 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,596 KB
testcase_01 AC 75 ms
71,600 KB
testcase_02 AC 82 ms
71,504 KB
testcase_03 AC 78 ms
71,604 KB
testcase_04 AC 77 ms
71,608 KB
testcase_05 AC 86 ms
76,552 KB
testcase_06 AC 82 ms
76,520 KB
testcase_07 AC 77 ms
71,592 KB
testcase_08 AC 130 ms
78,876 KB
testcase_09 AC 82 ms
76,512 KB
testcase_10 AC 565 ms
85,952 KB
testcase_11 AC 233 ms
80,000 KB
testcase_12 AC 131 ms
77,804 KB
testcase_13 AC 78 ms
71,720 KB
testcase_14 AC 77 ms
71,648 KB
testcase_15 AC 92 ms
76,828 KB
testcase_16 AC 759 ms
85,736 KB
testcase_17 AC 76 ms
71,592 KB
testcase_18 AC 101 ms
77,076 KB
testcase_19 AC 76 ms
71,780 KB
testcase_20 AC 82 ms
76,384 KB
testcase_21 AC 74 ms
71,656 KB
testcase_22 AC 101 ms
76,688 KB
testcase_23 AC 75 ms
71,616 KB
testcase_24 AC 205 ms
82,036 KB
testcase_25 AC 491 ms
81,592 KB
testcase_26 AC 75 ms
71,616 KB
testcase_27 AC 87 ms
76,612 KB
testcase_28 AC 77 ms
71,652 KB
testcase_29 AC 97 ms
76,924 KB
testcase_30 AC 434 ms
85,960 KB
testcase_31 AC 109 ms
77,648 KB
testcase_32 AC 105 ms
77,668 KB
testcase_33 AC 189 ms
81,376 KB
testcase_34 AC 392 ms
81,616 KB
testcase_35 AC 408 ms
85,148 KB
testcase_36 AC 76 ms
71,476 KB
testcase_37 AC 179 ms
78,568 KB
testcase_38 AC 834 ms
85,732 KB
testcase_39 AC 151 ms
78,400 KB
testcase_40 AC 76 ms
71,320 KB
testcase_41 AC 152 ms
77,984 KB
testcase_42 AC 77 ms
71,788 KB
testcase_43 AC 173 ms
78,484 KB
testcase_44 AC 74 ms
71,644 KB
testcase_45 AC 75 ms
71,320 KB
testcase_46 AC 75 ms
71,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    def mex(L):
        L = set(L)
        for i in range(21):
            if i not in L:
                return i

    N, 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 = 0
        for 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()
0