60842023-10-29 17:22:17horvathabelJardaTcpp17Accepted 40/403ms4072 KiB
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
    int n;
    cin>>n;
    vector<ll> dp={1,2,5};
    vector<ll> lyuk={0,2,4};
    ll mod=20200111;
    int cnt=0;
    for (int i=3; i<n;i++){
        dp.push_back((lyuk[i-1]+dp[i-1]+dp[i-2])%mod);
        lyuk.push_back((lyuk[i-1]+lyuk[i-2]+dp[i-2]*2)%mod);

    }
    cout<<dp[n-1]%mod;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1812 KiB
2Accepted0/03ms2064 KiB
3Accepted1/13ms2424 KiB
4Accepted1/13ms2524 KiB
5Accepted2/23ms2744 KiB
6Accepted2/23ms2868 KiB
7Accepted3/33ms3060 KiB
8Accepted3/33ms3196 KiB
9Accepted3/33ms3556 KiB
10Accepted3/33ms3684 KiB
11Accepted3/33ms3932 KiB
12Accepted3/33ms3944 KiB
13Accepted3/33ms3948 KiB
14Accepted3/33ms3948 KiB
15Accepted3/33ms3948 KiB
16Accepted3/33ms4072 KiB
17Accepted4/43ms3960 KiB