5982021-11-03 22:38:46TSomaToronyépítés (1,1,3,3)cpp14Hibás válasz 38/502ms1292 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);    

    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;

    

    if (N >= 390000) {
        int x = N % 6;
        switch (x) {
        case 0: a = 16421412; b = 288428; c = 10247200; break;
        case 1: a = 288428; b = 10247200; c = 12917008; break;
        case 2: a = 10247200; b = 12917008; c = 6200764; break;
        case 3: a = 12917008; b = 6200764; c = 12685820; break;
        case 4: a = 6200764; b = 12685820; c = 10785440; break;
        case 5: a = 12685820; b = 10785440; c = 13762300; break;
        }
        N -= 390000 - x;
    }
    else
    {
        N -= 6;
    }
    


    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) {
            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;
    }
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base38/50
1Elfogadva0/02ms1224 KiB
2Elfogadva0/01ms1292 KiB
3Elfogadva3/31ms1236 KiB
4Elfogadva3/31ms1172 KiB
5Elfogadva4/41ms1236 KiB
6Elfogadva4/41ms1236 KiB
7Hibás válasz0/42ms1240 KiB
8Elfogadva4/41ms1236 KiB
9Elfogadva4/41ms1240 KiB
10Elfogadva4/41ms1236 KiB
11Elfogadva4/41ms1236 KiB
12Hibás válasz0/41ms1240 KiB
13Hibás válasz0/42ms1176 KiB
14Elfogadva4/41ms1236 KiB
15Elfogadva2/21ms1236 KiB
16Elfogadva2/21ms1176 KiB