11242022-03-04 23:52:28TSomaToronyépítés (1,1,3,3)cpp14Accepted 50/507ms1364 KiB
#undef _GLIBCXX_DEBUG
#pragma GCC optimize("Ofast,inline")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <stdio.h>
#include <stdint.h>

using namespace std;

int_fast64_t N, i, a, b, c, d;
const int_fast64_t P = 20210108;

int main() 
{
#pragma warning(suppress : 4996)
	scanf("%d\n", &N);

	switch (N)
	{
	case 1:printf("%d\n", 2);break;
	case 2:printf("%d\n", 4);break;
	case 3:printf("%d\n", 10);break;
	default:
		a = 2;
		b = 4;
		c = 10;
		for (i = 4; i <= N; ++i)
		{
			d = (2 * (a + c)) % P;
			a = b;
			b = c;
			c = d;
		}
		printf("%d\n", d % P);
		break;
	}
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1224 KiB
2Accepted0/01ms1276 KiB
3Accepted3/31ms1308 KiB
4Accepted3/31ms1248 KiB
5Accepted4/41ms1236 KiB
6Accepted4/41ms1112 KiB
7Accepted4/47ms1320 KiB
8Accepted4/42ms1328 KiB
9Accepted4/41ms1272 KiB
10Accepted4/41ms1276 KiB
11Accepted4/42ms1280 KiB
12Accepted4/46ms1352 KiB
13Accepted4/46ms1224 KiB
14Accepted4/43ms1144 KiB
15Accepted2/21ms1292 KiB
16Accepted2/21ms1364 KiB