結果

問題 No.361 門松ゲーム2
ユーザー rlangevinrlangevin
提出日時 2023-08-31 08:54:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 410 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 76,860 KB
最終ジャッジ日時 2023-08-31 08:54:48
合計ジャッジ時間 5,423 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,436 KB
testcase_01 AC 69 ms
71,292 KB
testcase_02 AC 72 ms
71,360 KB
testcase_03 AC 71 ms
71,180 KB
testcase_04 AC 70 ms
71,364 KB
testcase_05 AC 69 ms
71,340 KB
testcase_06 AC 70 ms
71,256 KB
testcase_07 AC 73 ms
71,428 KB
testcase_08 AC 79 ms
76,540 KB
testcase_09 AC 79 ms
76,640 KB
testcase_10 AC 78 ms
76,756 KB
testcase_11 AC 76 ms
76,696 KB
testcase_12 AC 78 ms
76,656 KB
testcase_13 AC 81 ms
76,672 KB
testcase_14 AC 145 ms
76,764 KB
testcase_15 AC 87 ms
76,772 KB
testcase_16 AC 164 ms
76,860 KB
testcase_17 AC 148 ms
76,592 KB
testcase_18 AC 90 ms
76,844 KB
testcase_19 AC 152 ms
76,424 KB
testcase_20 AC 83 ms
76,652 KB
testcase_21 AC 159 ms
76,696 KB
testcase_22 AC 207 ms
76,740 KB
testcase_23 AC 157 ms
76,680 KB
testcase_24 AC 161 ms
76,752 KB
testcase_25 AC 166 ms
76,688 KB
testcase_26 AC 168 ms
76,688 KB
testcase_27 AC 168 ms
76,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

L, D = map(int, input().split())
dp = [0] * (L + 1)
for n in range(6, L + 1):
    S = set()
    for a in range(1, n):
        for b in range(a + 1, n):
            c = n - a - b
            if c <= b or c > a + D:
                continue
            S.add(dp[a]^dp[b]^dp[c])

    for i in range(L + 2):
        if i not in S:
            dp[n] = i
            break

print("kado") if dp[L] else print("matsu")
0