3952021-11-03 08:28:59SzankaBenedekToronyépítés (1,1,3,3)cpp11Wrong answer 18/507ms9536 KiB
#include <iostream>
#include <vector>

using namespace std;

int f(int input)
{
    vector<int> v(input);
    v[0] = 2;
    v[1] = 4;
    v[2] = 10; //8+2
    for (int n = 3; n <= input; n++)
    {
        v[n] = 2 * v[n - 1] + 2 * v[n - 3] % 20210108;
    }
    return v[input - 1];
}

int main()
{
    int a;
    cin >> a;
    cout << f(a) << "\n";
}
SubtaskSumTestVerdictTimeMemory
base18/50
1Accepted0/02ms1804 KiB
2Wrong answer0/01ms1896 KiB
3Accepted3/31ms1816 KiB
4Accepted3/31ms1924 KiB
5Runtime error0/42ms1904 KiB
6Runtime error0/41ms1908 KiB
7Wrong answer0/47ms9536 KiB
8Wrong answer0/42ms2648 KiB
9Accepted4/41ms1920 KiB
10Accepted4/41ms1816 KiB
11Wrong answer0/42ms3296 KiB
12Wrong answer0/47ms9536 KiB
13Wrong answer0/46ms8496 KiB
14Wrong answer0/43ms4332 KiB
15Accepted2/21ms1920 KiB
16Accepted2/21ms1928 KiB