109272024-04-19 19:58:1242Toronyépítés (1,1,3,3)python3Runtime error 0/5018ms13560 KiB
def t(n):
    if n in memo:
        return memo[n]
    if n%2==0:
        cur=(t(n//2-1)*t(n//2+1)+2*(t(n//2-3)*t(n//2)+t(n//2-2)*t(n//2-1)))%20210108
        memo[n]=cur
        return cur
    # n%2==1
    cur=(t(n//2)*t(n//2+1)+2*(t(n//2-2)*t(n//2)+t(n//2-1)*t(n//2-1)))%20210108
    memo[n]=cur
    return cur

print(t(int(input())))
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/018ms11272 KiB
2Runtime error0/017ms11852 KiB
3Runtime error0/317ms12068 KiB
4Runtime error0/317ms11940 KiB
5Runtime error0/417ms12224 KiB
6Runtime error0/417ms12424 KiB
7Runtime error0/417ms12716 KiB
8Runtime error0/417ms13052 KiB
9Runtime error0/417ms13124 KiB
10Runtime error0/417ms12948 KiB
11Runtime error0/417ms13168 KiB
12Runtime error0/417ms13368 KiB
13Runtime error0/417ms13028 KiB
14Runtime error0/417ms13152 KiB
15Runtime error0/217ms13364 KiB
16Runtime error0/218ms13560 KiB