122232024-12-09 17:39:27Firesloth28Toronyépítés (1,1,3,3)python3Accepted 50/50163ms3316 KiB
from sys import stdin, stdout

def torony(n):
    first, second, third = 2, 4, 10
    
    if n == 1:
        return 2
    if n == 2:
        return 4
    if n == 3:
        return 10

    for _ in range(4, n + 1):
        first, second, third = second, third, (first * 2 + third * 2) % 20210108
    
    return third

def main():
    n = int(stdin.readline())
    stdout.write(str(torony(n)))

main()
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/016ms3316 KiB
2Accepted0/017ms2872 KiB
3Accepted3/316ms3128 KiB
4Accepted3/316ms3124 KiB
5Accepted4/417ms2872 KiB
6Accepted4/417ms3124 KiB
7Accepted4/4163ms3092 KiB
8Accepted4/435ms3100 KiB
9Accepted4/414ms3128 KiB
10Accepted4/414ms2996 KiB
11Accepted4/443ms3088 KiB
12Accepted4/4159ms3084 KiB
13Accepted4/4143ms3096 KiB
14Accepted4/464ms3128 KiB
15Accepted2/214ms3128 KiB
16Accepted2/214ms3104 KiB