結果

問題 No.1267 Stop and Coin Game
ユーザー LyricalMaestroLyricalMaestro
提出日時 2024-01-23 01:20:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,019 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 83,548 KB
最終ジャッジ日時 2024-01-23 01:20:12
合計ジャッジ時間 9,311 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 34 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 62 ms
70,392 KB
testcase_06 AC 50 ms
64,180 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 42 ms
59,848 KB
testcase_10 WA -
testcase_11 AC 181 ms
77,400 KB
testcase_12 WA -
testcase_13 AC 35 ms
53,460 KB
testcase_14 WA -
testcase_15 AC 45 ms
62,108 KB
testcase_16 AC 678 ms
83,540 KB
testcase_17 AC 36 ms
53,460 KB
testcase_18 AC 51 ms
66,248 KB
testcase_19 AC 35 ms
53,460 KB
testcase_20 AC 43 ms
61,848 KB
testcase_21 AC 35 ms
53,460 KB
testcase_22 AC 50 ms
66,248 KB
testcase_23 AC 35 ms
53,460 KB
testcase_24 AC 317 ms
79,448 KB
testcase_25 WA -
testcase_26 AC 35 ms
53,460 KB
testcase_27 AC 75 ms
75,604 KB
testcase_28 AC 35 ms
53,460 KB
testcase_29 AC 50 ms
66,260 KB
testcase_30 AC 654 ms
83,544 KB
testcase_31 WA -
testcase_32 AC 76 ms
76,220 KB
testcase_33 WA -
testcase_34 AC 317 ms
79,448 KB
testcase_35 AC 660 ms
83,548 KB
testcase_36 AC 38 ms
53,460 KB
testcase_37 WA -
testcase_38 AC 661 ms
83,540 KB
testcase_39 AC 87 ms
75,864 KB
testcase_40 AC 36 ms
53,460 KB
testcase_41 AC 86 ms
75,864 KB
testcase_42 AC 35 ms
53,460 KB
testcase_43 WA -
testcase_44 AC 37 ms
53,460 KB
testcase_45 AC 36 ms
53,460 KB
testcase_46 AC 36 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/1267


def main():
    N, V = map(int, input().split())
    A = list(map(int, input().split()))

    if V - sum(A) >= 0:
        print("Draw")
        return

    grandies = [-1] * (1 << N)
    for bit in range(1 << N):
        b = (1 << N - 1) & (~bit)

        v = 0
        for i in range(N):
            if b & (1 << i):
                v += A[i]
        if V - v < 0:
            grandies[bit] = 0
        else:
            rest_v = V - v
            grandy_set = set()
            for i in range(N):
                if bit & (1 << i):
                    if rest_v - A[i] < 0:
                        continue

                    bit_ = bit - (1 << i)
                    grandy_set.add(grandies[bit_])
            for i in range(N + 2):
                if i not in grandy_set:
                    grandies[bit] = i
                    break



    if grandies[1 << N - 1] == 0:
        print("Second")
    else:
        print("First")



if __name__ == '__main__':
    main()
0