96562024-02-23 18:06:09NagyLeoToronyépítés (1,1,3,3)pypy3Runtime error 26/5074ms100496 KiB
import sys

sys.setrecursionlimit(10**9)

memo={}

def main():
    N = int(input())

    def torony(magassag):
        if magassag == 0:
            return 0
        if magassag == 1:
            return 2
        if magassag == 2:
            return 4
        if magassag == 3:
            return 8+2
        if magassag in memo:
            return memo[magassag]
        res=0
        res += 2*torony(magassag-1)
        if magassag >= 3:
            res += 2*torony(magassag - 3)
        memo[magassag]=res%20210108
        return res%20210108

    print(torony(N))

main()
SubtaskSumTestVerdictTimeMemory
base26/50
1Accepted0/041ms76280 KiB
2Accepted0/068ms92240 KiB
3Accepted3/339ms76536 KiB
4Accepted3/339ms77260 KiB
5Accepted4/439ms76900 KiB
6Accepted4/439ms77332 KiB
7Runtime error0/464ms100496 KiB
8Runtime error0/465ms100216 KiB
9Accepted4/446ms77888 KiB
10Accepted4/443ms78348 KiB
11Runtime error0/464ms99896 KiB
12Runtime error0/464ms99664 KiB
13Runtime error0/464ms100052 KiB
14Runtime error0/474ms99556 KiB
15Accepted2/243ms78836 KiB
16Accepted2/246ms78836 KiB