結果

問題 No.361 門松ゲーム2
ユーザー vwxyzvwxyz
提出日時 2022-08-10 04:42:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,640 KB
実行使用メモリ 72,608 KB
最終ジャッジ日時 2023-10-20 13:35:13
合計ジャッジ時間 3,356 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,448 KB
testcase_01 AC 38 ms
53,448 KB
testcase_02 AC 38 ms
53,448 KB
testcase_03 AC 37 ms
53,448 KB
testcase_04 AC 37 ms
53,448 KB
testcase_05 AC 37 ms
53,448 KB
testcase_06 AC 38 ms
53,448 KB
testcase_07 AC 39 ms
53,448 KB
testcase_08 AC 61 ms
62,156 KB
testcase_09 AC 51 ms
62,160 KB
testcase_10 AC 51 ms
62,160 KB
testcase_11 AC 45 ms
59,716 KB
testcase_12 AC 51 ms
62,160 KB
testcase_13 AC 50 ms
62,160 KB
testcase_14 AC 109 ms
70,396 KB
testcase_15 AC 56 ms
64,228 KB
testcase_16 AC 111 ms
72,460 KB
testcase_17 AC 102 ms
72,460 KB
testcase_18 AC 61 ms
66,276 KB
testcase_19 AC 100 ms
72,460 KB
testcase_20 AC 54 ms
64,228 KB
testcase_21 AC 107 ms
72,460 KB
testcase_22 AC 154 ms
72,608 KB
testcase_23 AC 99 ms
70,384 KB
testcase_24 AC 102 ms
72,464 KB
testcase_25 AC 107 ms
72,480 KB
testcase_26 AC 109 ms
72,556 KB
testcase_27 AC 112 ms
72,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

L,D=map(int,readline().split())
grundy=[None]*(L+1)
grundy[0]=0
grundy[1]=0
for l in range(2,L+1):
    se=set()
    for L1 in range(1,l-1):
        for L2 in range(L1+1,l-L1):
            L3=l-L1-L2
            if L2<L3 and L3-L1<=D:
                se.add(grundy[L1]^grundy[L2]^grundy[L3])
    x=0
    while x in se:
        x+=1
    grundy[l]=x
if grundy[L]:
    ans="kado"
else:
    ans="matsu"
print(ans)
0