61102023-10-31 21:31:41hackemonJardaTcpp17Runtime error 38/403ms3784 KiB
#include <bits/stdc++.h>
using namespace std;
//using namespace std::chrono;

#define pii pair<int,int>
#define pb push_back
#define vi vector<int>
#define vb vector<bool>
#define vl vector<ll>
#define vvi vector<vi>
#define vvb vector<vb>
#define vvl vector<vl>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define fScan {ios_base::sync_with_stdio(false); cin.tie(NULL);}
#define rep(i, a, b) for(int i = a; i < (b); i++)
#define REP(i, n) for(int i = 0;i <(n); i++)
using ll = long long;
using ld = long double;
ll mod = 1000000007;

const char ny =  '\n';

bool prime(ll a) {
    if (a==1) return 0;
    for (int i=2;i*i<=a;++i)
    {
        if (a%i==0) return 0;
    }

    return 1;
}

ll gcd(ll a,ll b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}

ll min(int a, ll b) {
    if(a< b) return a;
    else return b;
}

    long long modul = 20200111;
    
    void solve() { 
         int n;
         cin >> n;
         vector<long long> ans(n+1), nyitott(n+1, 1);
         ans[1] = 1;
         ans[2] = 2;
         ans[3] = 5;
         nyitott[3] = 2;
         nyitott[4] = 5;
         ans[4] = ans[3] + ans[2] + nyitott[3] * 2;
         for(int i = 5;i<=n;i++ ) {
            nyitott[i] = (nyitott[i-1] + nyitott[i-2] + ans[i-2])%modul;
            ans[i] = (ans[i-1] + ans[i-2] + nyitott[i-1]*2)%modul; 
         }
        
         cout << ans[n]%modul << endl;
    }


int main()
{
    fScan

    int t = 1;
    //comment out if necessary
    //cin>> t;


    //auto start = high_resolution_clock::now();
    while(t-- ) {
        solve();
    }
    //auto end = high_resolution_clock::now();
    //auto dur = duration_cast<milliseconds>(end-start);
    //cout<< "runtime: " << dur.count() << " milliseconds" << '\n';
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base38/40
1Accepted0/03ms1704 KiB
2Accepted0/03ms2012 KiB
3Runtime error0/13ms2188 KiB
4Runtime error0/13ms2436 KiB
5Accepted2/23ms2592 KiB
6Accepted2/23ms2800 KiB
7Accepted3/33ms3016 KiB
8Accepted3/32ms3228 KiB
9Accepted3/33ms3460 KiB
10Accepted3/33ms3604 KiB
11Accepted3/33ms3648 KiB
12Accepted3/32ms3652 KiB
13Accepted3/33ms3648 KiB
14Accepted3/32ms3652 KiB
15Accepted3/32ms3656 KiB
16Accepted3/33ms3656 KiB
17Accepted4/43ms3784 KiB