結果

問題 No.361 門松ゲーム2
ユーザー vwxyzvwxyz
提出日時 2022-08-10 04:40:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 480 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 14,480 KB
最終ジャッジ日時 2023-10-20 13:33:50
合計ジャッジ時間 5,352 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
14,480 KB
testcase_01 AC 29 ms
10,108 KB
testcase_02 AC 30 ms
10,108 KB
testcase_03 AC 29 ms
10,108 KB
testcase_04 AC 29 ms
10,108 KB
testcase_05 AC 29 ms
10,108 KB
testcase_06 AC 30 ms
10,108 KB
testcase_07 AC 30 ms
10,108 KB
testcase_08 AC 153 ms
10,108 KB
testcase_09 AC 171 ms
10,108 KB
testcase_10 AC 117 ms
10,108 KB
testcase_11 AC 41 ms
10,108 KB
testcase_12 AC 126 ms
10,108 KB
testcase_13 AC 126 ms
10,108 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

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(1,l-L1):
            L3=l-L1-L2
            if len({L1,L2,L3})==3 and max(L1,L2,L3)-min(L1,L2,L3)<=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