4632021-11-03 16:53:25TSomaToronyépítés (1,1,3,3)cpp11Wrong answer 26/504ms1972 KiB
#include <iostream>

int main()
{
    std::cin.sync_with_stdio(false);
    std::cin.tie(nullptr);



    int N;
    std::cin >> N;

    //std::vector<int> v(N+1);
    unsigned long long int v[4];

    v[0] = 1;
    v[1] = 2;
    v[2] = 4;
    v[3] = 0;

    int a, b, c, j = 3;

    for (size_t i = 3; i < N + 1; i++)
    {
        if (j > 3)
            j = 0;

        c = j;
        a = c - 1;
        b = c - 3;

        if (b < 0) {
            b += 4;
            if (a < 0)
                a = 3;
        }

        v[c] = (2 * v[a] + 2 * v[b]);

        if (v[c] >= 9223372036854775807)
            v[c] %= 20210108;

        j++;
    }

    std::cout << v[N % 4] % 20210108;
}
SubtaskSumTestVerdictTimeMemory
base26/50
1Accepted0/02ms1892 KiB
2Wrong answer0/01ms1908 KiB
3Accepted3/32ms1972 KiB
4Accepted3/31ms1964 KiB
5Accepted4/41ms1972 KiB
6Accepted4/42ms1964 KiB
7Wrong answer0/44ms1968 KiB
8Wrong answer0/42ms1968 KiB
9Accepted4/41ms1972 KiB
10Accepted4/41ms1964 KiB
11Wrong answer0/43ms1964 KiB
12Wrong answer0/44ms1972 KiB
13Wrong answer0/44ms1968 KiB
14Wrong answer0/42ms1964 KiB
15Accepted2/21ms1964 KiB
16Accepted2/21ms1964 KiB