4572021-11-03 16:22:07kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Accepted 50/504ms1920 KiB
#include <iostream>

unsigned int N, a, b, c;

int main() {
	std::cin >> N;
	switch (N % 3) {
	case 0:
		c = 1;
		break;
	case 1:
		b = 1;
		c = 2;
		break;
	case 2:
		a = 1;
		b = 2;
		c = 4;
		break;
	}
	N -= N % 3;
	while (N > 5) {
		a = 2 * (a + c);
		b = 2 * (b + a);
		c = 2 * (c + b);
		a = 2 * (a + c) % 20210108;
		b = 2 * (b + a) % 20210108;
		c = 2 * (c + b) % 20210108;
		N -= 6;
	}
	if (N) {
		a = 2 * (a + c);
		b = 2 * (b + a);
		c = 2 * (c + b) % 20210108;
	}
	std::cout << c;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1804 KiB
2Accepted0/01ms1876 KiB
3Accepted3/31ms1816 KiB
4Accepted3/31ms1920 KiB
5Accepted4/41ms1816 KiB
6Accepted4/41ms1920 KiB
7Accepted4/44ms1920 KiB
8Accepted4/41ms1816 KiB
9Accepted4/41ms1816 KiB
10Accepted4/41ms1920 KiB
11Accepted4/42ms1920 KiB
12Accepted4/44ms1816 KiB
13Accepted4/43ms1920 KiB
14Accepted4/42ms1816 KiB
15Accepted2/21ms1816 KiB
16Accepted2/21ms1920 KiB