32022023-02-22 13:08:0412BotiJardaTpython3Accepted 40/4023ms14964 KiB
from functools import cache


@cache
def r(a, b):
    if a == 0 and b == 0:
        return 1
    if a < 0 or b < 0:
        return 0

    x = 0
    if a == b:
        x += r(a - 1, b - 1)
        x += r(a - 2, b - 1)
        x += r(a - 1, b - 2)
        x += r(a - 2, b - 0)
    elif a > b:
        return r(b, a)
    elif a == b - 1:
        x += r(a - 1, b - 2)
        x += r(a - 1, b - 3)
        x += r(a - 0, b - 2)
    elif a == b - 2:
        x += r(a - 0, b - 2)
    # print(f"r({a}, {b}) = {x}")
    return x % 20200111


N = int(input())
print(r(N, N))
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/023ms12344 KiB
2Accepted0/023ms13032 KiB
3Accepted1/123ms12872 KiB
4Accepted1/121ms12732 KiB
5Accepted2/223ms12424 KiB
6Accepted2/221ms12576 KiB
7Accepted3/321ms12992 KiB
8Accepted3/323ms13164 KiB
9Accepted3/323ms13588 KiB
10Accepted3/323ms13796 KiB
11Accepted3/323ms14084 KiB
12Accepted3/323ms14064 KiB
13Accepted3/323ms14096 KiB
14Accepted3/321ms13884 KiB
15Accepted3/323ms14356 KiB
16Accepted3/321ms14668 KiB
17Accepted4/421ms14964 KiB