結果

問題 No.361 門松ゲーム2
ユーザー maspy
提出日時 2020-03-07 05:48:13
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,525 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-14 11:13:40
合計ジャッジ時間 14,178 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
import itertools

# %%
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