108782024-04-17 13:47:0142Toronyépítés (80 pont)python3Time limit exceeded 50/80163ms51468 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
base50/80
1Accepted0/017ms11136 KiB
2Accepted0/018ms11832 KiB
3Accepted4/417ms11988 KiB
4Accepted4/417ms11980 KiB
5Accepted5/517ms11664 KiB
6Accepted5/517ms11764 KiB
7Time limit exceeded0/6163ms51468 KiB
8Accepted6/654ms22204 KiB
9Accepted7/717ms12308 KiB
10Accepted7/717ms12588 KiB
11Accepted8/878ms28552 KiB
12Time limit exceeded0/8163ms51384 KiB
13Time limit exceeded0/8126ms42804 KiB
14Time limit exceeded0/8118ms39576 KiB
15Accepted2/217ms13208 KiB
16Accepted2/217ms13052 KiB