108792024-04-17 13:48:2542Toronyépítés (80 pont)pypy3Runtime error 36/8068ms101728 KiB
from sys import stdin
input=stdin.readline

mod=20210108

def main():
    N=int(input())
    if N<10**6//2:
        s=[1,3,10]
        for i in range(N):
            s.append((3*s[-1]+s[-2])%mod)
        print(s[N])
    else:
        s=[19343794, 15553821]
        N-=10**6//2
        for i in range(N):
            s.append((3*s[-1]+s[-2])%mod)
        print(s[N])
main()
SubtaskSumTestVerdictTimeMemory
base36/80
1Accepted0/046ms76168 KiB
2Accepted0/054ms85804 KiB
3Accepted4/446ms76660 KiB
4Accepted4/443ms77152 KiB
5Accepted5/539ms77632 KiB
6Accepted5/546ms77524 KiB
7Runtime error0/659ms101728 KiB
8Runtime error0/668ms101068 KiB
9Accepted7/746ms77944 KiB
10Accepted7/743ms78724 KiB
11Runtime error0/864ms100884 KiB
12Runtime error0/854ms100416 KiB
13Runtime error0/857ms100276 KiB
14Runtime error0/864ms100252 KiB
15Accepted2/241ms78804 KiB
16Accepted2/246ms79160 KiB