結果

問題 No.361 門松ゲーム2
ユーザー chocorusk
提出日時 2020-09-26 03:09:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 289 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 73,748 KB
最終ジャッジ日時 2024-06-28 12:05:54
合計ジャッジ時間 4,522 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines

l, d=map(int, readline().split())
g=[0]*(l+1)
for x in range(1, l+1):
    st=set()
    for a in range(1, x):
        for b in range(1, a):
            c=x-a-b
            if 0<c and c<b and a-c<=d:
                st.add(g[a]^g[b]^g[c])
    i=0
    while True:
        if i not in st:
            g[x]=i
            break
        i+=1
if g[l]:
    print("kado")
else:
    print("matsu")
0