50412023-04-10 21:21:29TSomaToronyépítés (1,1,3,3)cpp14Wrong answer 26/504ms2724 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>

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

    if (N > 0) {
        int_fast32_t a = 2, b = 4, c = 10, d = 24, e = 56, f = 132;
        const int_fast32_t x = 2, z = 202101080000, m = 20210108;

        N -= 6;

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

            if (f >= z) {
                d -= z;
                e -= z;
                f -= z;

                if (f >= z) {
                    d -= z;
                    e -= z;
                    f -= z;
                }
            }

            N -= 6;
        }


        switch (N % 6) {
        case 0: printf("%d\n", f % m); break;
        case -1: printf("%d\n", e % m); break;
        case -2: printf("%d\n", d % m); break;
        case -3: printf("%d\n", c % m); break;
        case -4: printf("%d\n", b % m); break;
        case -5: printf("%d\n", a % m); break;
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base26/50
1Accepted0/02ms1392 KiB
2Wrong answer0/02ms1568 KiB
3Accepted3/32ms1732 KiB
4Accepted3/32ms1824 KiB
5Accepted4/42ms1804 KiB
6Accepted4/43ms2028 KiB
7Wrong answer0/44ms2136 KiB
8Wrong answer0/43ms2036 KiB
9Accepted4/42ms2260 KiB
10Accepted4/42ms2468 KiB
11Wrong answer0/43ms2652 KiB
12Wrong answer0/44ms2640 KiB
13Wrong answer0/44ms2656 KiB
14Wrong answer0/43ms2724 KiB
15Accepted2/22ms2652 KiB
16Accepted2/22ms2612 KiB