結果

問題 No.314 ケンケンパ
ユーザー karinohitokarinohito
提出日時 2023-03-23 01:43:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 90 ms / 1,000 ms
コード長 517 bytes
コンパイル時間 4,438 ms
コンパイル使用メモリ 265,968 KB
実行使用メモリ 58,052 KB
最終ジャッジ日時 2023-10-18 19:18:18
合計ジャッジ時間 5,657 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
56,996 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 3 ms
4,348 KB
testcase_16 AC 5 ms
4,612 KB
testcase_17 AC 12 ms
8,836 KB
testcase_18 AC 45 ms
29,420 KB
testcase_19 AC 90 ms
58,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
using mint = modint1000000007;
using vm = vector<mint>;
using vvm = vector<vm>;

int main() {
    ll N;
    cin>>N;
    vvm DP(N+100,vm(4,0));
    DP[0][1]=1;
    rep(i,N)rep(j,4)rep(k,2){
        ll b=j*2+k;
        if(b==0||b%4==3)continue;
        DP[i+1][b%4]+=DP[i][j];
    }
    mint an=0;
    rep(i,4)an+=DP[N][i];
    cout<<an.val()<<endl;
}
0