4532021-11-03 15:26:59kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Accepted 50/506ms1908 KiB
#include <iostream>

int N, a, b, c;

int main() {
	std::cin.sync_with_stdio(false);
	std::cin.tie(nullptr);

	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) {
		a = 2 * (a + c) % 20210108;
		b = 2 * (b + a) % 20210108;
		c = 2 * (c + b) % 20210108;
		N -= 3;
	}
	std::cout << c;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1824 KiB
2Accepted0/01ms1852 KiB
3Accepted3/31ms1900 KiB
4Accepted3/31ms1904 KiB
5Accepted4/41ms1904 KiB
6Accepted4/41ms1900 KiB
7Accepted4/46ms1900 KiB
8Accepted4/42ms1900 KiB
9Accepted4/41ms1908 KiB
10Accepted4/41ms1904 KiB
11Accepted4/42ms1904 KiB
12Accepted4/46ms1900 KiB
13Accepted4/46ms1904 KiB
14Accepted4/43ms1900 KiB
15Accepted2/21ms1900 KiB
16Accepted2/21ms1904 KiB