結果

問題 No.361 門松ゲーム2
ユーザー maspymaspy
提出日時 2020-03-07 05:48:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 67,456 KB
最終ジャッジ日時 2024-04-22 11:52:44
合計ジャッジ時間 3,153 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,096 KB
testcase_01 AC 38 ms
52,224 KB
testcase_02 AC 38 ms
51,968 KB
testcase_03 AC 37 ms
51,968 KB
testcase_04 AC 37 ms
51,968 KB
testcase_05 AC 38 ms
51,968 KB
testcase_06 AC 38 ms
52,096 KB
testcase_07 AC 38 ms
52,352 KB
testcase_08 AC 48 ms
61,696 KB
testcase_09 AC 50 ms
61,952 KB
testcase_10 AC 46 ms
60,288 KB
testcase_11 AC 44 ms
59,648 KB
testcase_12 AC 51 ms
62,080 KB
testcase_13 AC 48 ms
61,568 KB
testcase_14 AC 94 ms
66,304 KB
testcase_15 AC 56 ms
63,872 KB
testcase_16 AC 99 ms
66,816 KB
testcase_17 AC 96 ms
67,328 KB
testcase_18 AC 56 ms
63,720 KB
testcase_19 AC 98 ms
66,688 KB
testcase_20 AC 53 ms
63,360 KB
testcase_21 AC 95 ms
66,944 KB
testcase_22 AC 127 ms
66,176 KB
testcase_23 AC 79 ms
64,896 KB
testcase_24 AC 162 ms
65,536 KB
testcase_25 AC 116 ms
66,944 KB
testcase_26 AC 106 ms
67,072 KB
testcase_27 AC 105 ms
67,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# %%
L, D = map(int, read().split())

# %%
G = [0] * (L + 1)
for n in range(1, L + 1):
    se = set()
    for i in range(1, n):
        if 3 * i > n:
            break
        for j in range(i + 1, n):
            k = n - i - j
            if k - i > D:
                continue
            if k <= j:
                break
            se.add(G[i] ^ G[j] ^ G[k])
    g = 0
    while g in se:
        g += 1
    G[n] = g


# %%
print('kado' if G[L] else 'matsu')
0