6692021-11-07 11:05:33TSomaToronyépítés (2,2,3,3)cpp14Wrong answer 0/402ms1280 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;

long long N, i, a, b, c, d;
long long const 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;
	}
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Wrong answer0/02ms1156 KiB
2Wrong answer0/01ms1264 KiB
3Wrong answer0/21ms1164 KiB
4Wrong answer0/21ms1100 KiB
5Wrong answer0/31ms1164 KiB
6Wrong answer0/31ms1236 KiB
7Wrong answer0/32ms1240 KiB
8Wrong answer0/31ms1176 KiB
9Wrong answer0/31ms1188 KiB
10Wrong answer0/31ms1248 KiB
11Wrong answer0/32ms1260 KiB
12Wrong answer0/32ms1136 KiB
13Wrong answer0/42ms1264 KiB
14Wrong answer0/42ms1268 KiB
15Wrong answer0/21ms1272 KiB
16Wrong answer0/21ms1280 KiB