結果

問題 No.361 門松ゲーム2
ユーザー Coki628Coki628
提出日時 2020-12-15 18:42:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 1,192 bytes
コンパイル時間 1,303 ms
コンパイル使用メモリ 81,780 KB
実行使用メモリ 75,824 KB
最終ジャッジ日時 2023-10-20 06:17:28
合計ジャッジ時間 3,360 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,532 KB
testcase_01 AC 38 ms
53,532 KB
testcase_02 AC 38 ms
53,532 KB
testcase_03 AC 38 ms
53,532 KB
testcase_04 AC 38 ms
53,532 KB
testcase_05 AC 37 ms
53,532 KB
testcase_06 AC 37 ms
53,532 KB
testcase_07 AC 38 ms
53,532 KB
testcase_08 AC 61 ms
70,100 KB
testcase_09 AC 69 ms
73,100 KB
testcase_10 AC 55 ms
66,016 KB
testcase_11 AC 54 ms
66,076 KB
testcase_12 AC 62 ms
68,408 KB
testcase_13 AC 61 ms
68,408 KB
testcase_14 AC 231 ms
75,816 KB
testcase_15 AC 69 ms
72,484 KB
testcase_16 AC 114 ms
75,612 KB
testcase_17 AC 87 ms
75,572 KB
testcase_18 AC 78 ms
75,592 KB
testcase_19 AC 81 ms
75,576 KB
testcase_20 AC 68 ms
72,488 KB
testcase_21 AC 116 ms
75,608 KB
testcase_22 AC 337 ms
75,824 KB
testcase_23 AC 67 ms
70,432 KB
testcase_24 AC 70 ms
72,492 KB
testcase_25 AC 72 ms
72,500 KB
testcase_26 AC 90 ms
75,576 KB
testcase_27 AC 95 ms
75,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for k in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

N, D = MAP()

memo = [-1] * (N+1)
def rec(n):
    if memo[n] != -1:
        return memo[n]
    se = set()
    for i in range(1, n):
        for j in range(i+1, n):
            k = n-i-j
            if k <= 0:
                break
            if i != j and j != k and k != i and max(i, j, k) - min(i, j, k) <= D:
                res = rec(i) ^ rec(j) ^ rec(k)
                se.add(res)
    g = 0
    while g in se:
        g += 1
    memo[n] = g
    return g

grundy = rec(N)
if grundy:
    print('kado')
else:
    print('matsu')
0