結果

問題 No.361 門松ゲーム2
ユーザー nisizawanisizawa
提出日時 2017-12-09 10:12:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,053 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 7,956 KB
最終ジャッジ日時 2023-08-20 02:50:08
合計ジャッジ時間 4,692 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,840 KB
testcase_01 AC 16 ms
7,804 KB
testcase_02 AC 15 ms
7,772 KB
testcase_03 AC 15 ms
7,856 KB
testcase_04 AC 15 ms
7,756 KB
testcase_05 AC 13 ms
7,828 KB
testcase_06 AC 14 ms
7,944 KB
testcase_07 AC 13 ms
7,756 KB
testcase_08 AC 15 ms
7,800 KB
testcase_09 AC 18 ms
7,832 KB
testcase_10 AC 15 ms
7,888 KB
testcase_11 AC 14 ms
7,836 KB
testcase_12 AC 16 ms
7,880 KB
testcase_13 AC 15 ms
7,812 KB
testcase_14 AC 560 ms
7,956 KB
testcase_15 AC 26 ms
7,880 KB
testcase_16 AC 337 ms
7,876 KB
testcase_17 AC 118 ms
7,824 KB
testcase_18 AC 73 ms
7,808 KB
testcase_19 AC 92 ms
7,804 KB
testcase_20 AC 32 ms
7,772 KB
testcase_21 AC 387 ms
7,892 KB
testcase_22 AC 1,053 ms
7,764 KB
testcase_23 AC 44 ms
7,756 KB
testcase_24 AC 48 ms
7,836 KB
testcase_25 AC 57 ms
7,876 KB
testcase_26 AC 133 ms
7,896 KB
testcase_27 AC 185 ms
7,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

l, d = map(int, input().split())

g_list = [0] * (l + 1)
for i in range(6, l + 1):
    g_set = set()
    for l1 in range(1, i // 3):
        for l2 in range(max(l1 + 1, i - 2 * l1 - d), int((i - l1) / 2 + 0.5)):
            l3 = i - l1 - l2
            g_set.add(g_list[l1] ^ g_list[l2] ^ g_list[l3])
    if 0 not in g_set:
        g_list[i] = 0
    else:
        for n in range(max(g_set) + 2):
            if n not in g_set:
                g_list[i] = n
                break
if g_list[l] == 0:
    print('matsu')
else:
    print('kado')
0