4582021-11-03 16:37:53TSomaToronyépítés (1,1,3,3)cpp11Wrong answer 18/508ms2044 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);
    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] > 20210108) 
            v[c] -= 20210108;

        j++;
    }

    std::cout << v[N % 4];
}
SubtaskSumTestVerdictTimeMemory
base18/50
1Accepted0/02ms1884 KiB
2Wrong answer0/01ms1928 KiB
3Accepted3/31ms1988 KiB
4Accepted3/31ms1964 KiB
5Wrong answer0/41ms1996 KiB
6Wrong answer0/42ms2000 KiB
7Wrong answer0/48ms2004 KiB
8Wrong answer0/42ms2008 KiB
9Accepted4/41ms2008 KiB
10Accepted4/42ms2012 KiB
11Wrong answer0/43ms2016 KiB
12Wrong answer0/48ms2044 KiB
13Wrong answer0/48ms2028 KiB
14Wrong answer0/44ms2028 KiB
15Accepted2/21ms2036 KiB
16Accepted2/21ms2040 KiB