17462022-12-02 13:49:041478Toronyépítés (1,1,3,3)cpp11Accepted 50/5017ms11124 KiB
#include <bits/stdc++.h>  
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
 
const int N_MAX = 1000000;
const int MODULO = 20210108;
vector<int> dp(N_MAX);

int main()
{

    int n;
    cin>>n;
    dp[0] = 1;
    dp[1] = 2;
    dp[2] = 4;
    for(int i=3; i<=n; i++){
        dp[i] = ((2*dp[i-1]) % MODULO + (2*dp[i-3]) % MODULO) % MODULO;
    }

    cout<<dp[n];

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/06ms9532 KiB
2Accepted0/04ms9820 KiB
3Accepted3/34ms10024 KiB
4Accepted3/34ms10132 KiB
5Accepted4/44ms10084 KiB
6Accepted4/44ms10080 KiB
7Accepted4/417ms10080 KiB
8Accepted4/47ms10336 KiB
9Accepted4/44ms10416 KiB
10Accepted4/44ms10444 KiB
11Accepted4/47ms10640 KiB
12Accepted4/416ms10672 KiB
13Accepted4/416ms10968 KiB
14Accepted4/48ms10916 KiB
15Accepted2/24ms11124 KiB
16Accepted2/24ms11112 KiB