結果

問題 No.361 門松ゲーム2
コンテスト
ユーザー maspy
提出日時 2020-03-07 05:48:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 67,200 KB
最終ジャッジ日時 2024-10-14 11:13:50
合計ジャッジ時間 3,012 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

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