13652022-05-23 13:04:22nkdorka1212Toronyépítés (1,1,3,3)cpp11Accepted 50/5041ms38152 KiB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define accept_plss ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
int mod=20210108;
vector<int>torony;

int epit(int n)
{
    if(n==1) return 2;
    if(n==2) return 4;
    if(n==3) return 10;
    if(torony[n]!=0) return torony[n];
    torony[n]=epit(n-3)*2+epit(n-1)*2;
    torony[n]%=mod;
    return torony[n];
}

signed main()
{
    accept_plss;
    int n;
    cin>>n;
    torony.resize(1000000,0);
    cout<<epit(n);

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/08ms17368 KiB
2Accepted0/08ms17452 KiB
3Accepted3/38ms17472 KiB
4Accepted3/37ms17520 KiB
5Accepted4/48ms17428 KiB
6Accepted4/48ms17440 KiB
7Accepted4/441ms38152 KiB
8Accepted4/412ms20068 KiB
9Accepted4/48ms17488 KiB
10Accepted4/48ms17424 KiB
11Accepted4/414ms21628 KiB
12Accepted4/441ms38148 KiB
13Accepted4/435ms35552 KiB
14Accepted4/417ms24472 KiB
15Accepted2/225ms17560 KiB
16Accepted2/28ms17508 KiB