5592021-11-03 20:30:33Kris030Toronyépítés (1,1,3,3)cpp11Accepted 50/503ms1224 KiB
#include "stdio.h"

int main() {

	typedef unsigned long long int ulli;
	const ulli MN = 20210108, LMN3 = MN * 1000, LMN5 = LMN3 * 100;
	ulli a = 2, b = 4, c = 10;

	typedef unsigned int NT; NT N;
	scanf("%d\n", &N);

    for (; N > 3; N -= 3) {
		a = 2 * (c + a);
		b = 2 * (a + b);
		c = 2 * (b + c);

		if (c >= LMN5) {
			c %= LMN3;
			if (b >= LMN5) {
				b %= LMN3;
				if (a >= LMN5)
					a %= LMN3;
			}
		}
	}

	if (N >= 3)
		N = N % 3;
	
	switch (N) {
		case 0: printf("%d\n", c % MN); break;
		case 1: printf("%d\n", a % MN); break;
		case 2: printf("%d\n", b % MN); break;
	}
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms1224 KiB
2Accepted0/01ms1184 KiB
3Accepted3/31ms1136 KiB
4Accepted3/31ms1208 KiB
5Accepted4/41ms1144 KiB
6Accepted4/41ms1136 KiB
7Accepted4/43ms1080 KiB
8Accepted4/41ms1140 KiB
9Accepted4/41ms1204 KiB
10Accepted4/41ms1136 KiB
11Accepted4/41ms1140 KiB
12Accepted4/43ms1204 KiB
13Accepted4/43ms1208 KiB
14Accepted4/42ms1204 KiB
15Accepted2/21ms1140 KiB
16Accepted2/21ms1140 KiB