6712021-11-07 11:12:05TSomaToronyépítés (2,2,3,3)cpp14Wrong answer 0/402ms1208 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
base0/40
1Wrong answer0/02ms1160 KiB
2Wrong answer0/01ms1184 KiB
3Wrong answer0/21ms1204 KiB
4Wrong answer0/21ms1140 KiB
5Wrong answer0/31ms1144 KiB
6Wrong answer0/31ms1136 KiB
7Wrong answer0/32ms1144 KiB
8Wrong answer0/32ms1208 KiB
9Wrong answer0/31ms1208 KiB
10Wrong answer0/31ms1144 KiB
11Wrong answer0/32ms1204 KiB
12Wrong answer0/32ms1144 KiB
13Wrong answer0/42ms1208 KiB
14Wrong answer0/42ms1204 KiB
15Wrong answer0/21ms1208 KiB
16Wrong answer0/21ms1140 KiB