15932022-11-28 18:46:37kicsiboglarToronyépítés (1,1,3,3)cpp11Accepted 50/5016ms3672 KiB
#include <iostream>
#include <deque>
#define P 20210108

using namespace std;
deque <int> v;
long long n,i,j,a,b;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    v.push_back(1);
    v.push_back(2);
    v.push_back(4);
    if (n<3) cout<<v[n];
    else
    {
        i=2;
        while(i<n)
        {
            i++;
            a=(2*v[2]%P+2*v[0]%P)%P;
            v.pop_front();
            v.push_back(a);
        }
        cout<<v[2];
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1824 KiB
2Accepted0/02ms2060 KiB
3Accepted3/32ms2296 KiB
4Accepted3/32ms2496 KiB
5Accepted4/42ms2700 KiB
6Accepted4/42ms2936 KiB
7Accepted4/416ms2988 KiB
8Accepted4/44ms2988 KiB
9Accepted4/42ms2980 KiB
10Accepted4/42ms3112 KiB
11Accepted4/44ms3596 KiB
12Accepted4/416ms3636 KiB
13Accepted4/414ms3604 KiB
14Accepted4/47ms3600 KiB
15Accepted2/22ms3668 KiB
16Accepted2/22ms3672 KiB