2152021-02-18 11:58:09kicsiboglarToronyépítés (2,2,3,3)cpp11Wrong answer 38/403ms1908 KiB
#include <iostream>
#include <deque>
#define P 20210108

using namespace std;
deque <int> v;
long long n,i,j,a,b;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    v.push_back(1);
    v.push_back(1);
    v.push_back(2);
    v.push_back(2);
    v.push_back(4);
    if (n<=4) cout<<v[n];
    else
    {
        i=4;
        while(i<n)
        {
            i++;
            a=(2*v[3]%P+2*v[2]%P)%P;
            v.pop_front();
            v.push_back(a);
        }
        cout<<v[4];
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base38/40
1Accepted0/02ms1760 KiB
2Accepted0/01ms1792 KiB
3Accepted2/21ms1876 KiB
4Accepted2/21ms1860 KiB
5Accepted3/31ms1860 KiB
6Accepted3/31ms1864 KiB
7Accepted3/33ms1868 KiB
8Accepted3/32ms1876 KiB
9Accepted3/31ms1880 KiB
10Accepted3/31ms1884 KiB
11Accepted3/33ms1888 KiB
12Accepted3/33ms1896 KiB
13Accepted4/43ms1896 KiB
14Accepted4/42ms1900 KiB
15Accepted2/21ms1900 KiB
16Wrong answer0/21ms1908 KiB