109262024-04-19 19:56:3742Toronyépítés (1,1,3,3)python3Runtime error 0/5018ms13468 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)))%mod
        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)))%mod
    memo[n]=cur
    return cur

print(t(int(input())))
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/018ms11328 KiB
2Runtime error0/017ms11684 KiB
3Runtime error0/317ms12040 KiB
4Runtime error0/317ms12344 KiB
5Runtime error0/417ms12456 KiB
6Runtime error0/417ms12312 KiB
7Runtime error0/417ms12464 KiB
8Runtime error0/417ms12816 KiB
9Runtime error0/417ms12348 KiB
10Runtime error0/417ms12776 KiB
11Runtime error0/417ms13196 KiB
12Runtime error0/417ms12952 KiB
13Runtime error0/417ms13312 KiB
14Runtime error0/417ms13468 KiB
15Runtime error0/217ms13040 KiB
16Runtime error0/217ms13196 KiB