70932023-12-30 11:19:281478Járda-L (40)cpp17Wrong answer 4/403ms4304 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())
 
int main()
{
    //ifstream cin("in.txt");
    int n;
    cin >> n;

    vector<int> dpFull(n + 1);
    dpFull[1] = 1;
    dpFull[2] = 2;

    vector<int> dpMiss(n + 1);
    dpMiss[2] = 1;

    for(int i = 3; i <= n; i++){
        dpMiss[i] = 2 * dpMiss[i - 1] + dpFull[i - 2];
        dpFull[i] = 2 * dpMiss[i - 1] + dpFull[i - 1] + dpFull[i - 2];
    }

    cout << dpFull[n];
}
SubtaskSumTestVerdictTimeMemory
base4/40
1Accepted0/03ms1812 KiB
2Wrong answer0/03ms2056 KiB
3Accepted2/23ms2272 KiB
4Accepted2/23ms2476 KiB
5Wrong answer0/23ms2688 KiB
6Wrong answer0/23ms2884 KiB
7Wrong answer0/23ms2972 KiB
8Wrong answer0/33ms3116 KiB
9Wrong answer0/33ms3160 KiB
10Wrong answer0/33ms3376 KiB
11Wrong answer0/33ms3460 KiB
12Wrong answer0/33ms3588 KiB
13Wrong answer0/33ms3800 KiB
14Wrong answer0/33ms4008 KiB
15Wrong answer0/33ms4220 KiB
16Wrong answer0/33ms4304 KiB
17Wrong answer0/33ms4304 KiB