5932021-11-03 22:23:09TSomaToronyépítés (1,1,3,3)cpp14Accepted 50/502ms1244 KiB
#include <stdio.h>

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

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

    unsigned long long int a = 2;
    unsigned long long int b = 4;
    unsigned long long int c = 10;
    unsigned long long int d = 24;
    unsigned long long int e = 56;
    unsigned long long int f = 132;


    while (N > 0)
    {
        a = 2 * (f + d);
        b = 2 * (a + e);
        c = 2 * (b + f);
        d = 2 * (c + a);
        e = 2 * (d + b);
        f = 2 * (e + c);

        if (f >= 10105054000000000) {
            a %= 202101080000;
            b %= 202101080000;
            c %= 202101080000;
            d %= 202101080000;
            e %= 202101080000;
            f %= 202101080000;
        }

        N -= 6;
    }


    switch (N % 6) {
        case 0: printf("%d\n", f % 20210108); break;
        case -1: printf("%d\n", e % 20210108); break;
        case -2: printf("%d\n", d % 20210108); break;
        case -3: printf("%d\n", c % 20210108); break;
        case -4: printf("%d\n", b % 20210108); break;
        case -5: printf("%d\n", a % 20210108); break;
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1156 KiB
2Accepted0/01ms1244 KiB
3Accepted3/31ms1208 KiB
4Accepted3/31ms1204 KiB
5Accepted4/41ms1140 KiB
6Accepted4/41ms1204 KiB
7Accepted4/42ms1076 KiB
8Accepted4/41ms1204 KiB
9Accepted4/41ms1204 KiB
10Accepted4/41ms1208 KiB
11Accepted4/41ms1204 KiB
12Accepted4/42ms1204 KiB
13Accepted4/42ms1108 KiB
14Accepted4/41ms1204 KiB
15Accepted2/21ms1204 KiB
16Accepted2/21ms1204 KiB