結果

問題 No.1811 EQUIV Ten
ユーザー SSRSSSRS
提出日時 2022-01-14 21:35:33
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 320 ms / 2,000 ms
コード長 707 bytes
コンパイル時間 1,700 ms
コンパイル使用メモリ 171,384 KB
実行使用メモリ 185,944 KB
最終ジャッジ日時 2023-08-12 18:02:53
合計ジャッジ時間 5,425 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 265 ms
155,316 KB
testcase_12 AC 287 ms
166,924 KB
testcase_13 AC 310 ms
181,168 KB
testcase_14 AC 320 ms
185,928 KB
testcase_15 AC 317 ms
185,944 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 16 ms
11,180 KB
testcase_21 AC 13 ms
10,120 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 110 ms
65,224 KB
testcase_24 AC 23 ms
15,192 KB
testcase_25 AC 2 ms
4,384 KB
testcase_26 AC 89 ms
52,876 KB
testcase_27 AC 6 ms
5,760 KB
testcase_28 AC 1 ms
4,384 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 258 ms
150,672 KB
testcase_31 AC 10 ms
7,204 KB
testcase_32 AC 25 ms
16,532 KB
testcase_33 AC 27 ms
17,592 KB
testcase_34 AC 247 ms
142,908 KB
testcase_35 AC 87 ms
51,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main(){
  int N;
  cin >> N;
  vector<vector<vector<long long>>> dp(N + 1, vector<vector<long long>>(16, vector<long long>(2, 0)));
  dp[0][0][0] = 1;
  for (int i = 0; i < N; i++){
    for (int j = 0; j < 16; j++){
      for (int k = 0; k < 2; k++){
        for (int l = 0; l < 2; l++){
          int j2 = (j * 2 + l) % 16;
          int k2 = k;
          if (j2 == 10){
            k2 = 1;
          }
          dp[i + 1][j2][k2] += dp[i][j][k];
          dp[i + 1][j2][k2] %= MOD;
        }
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < 16; i++){
    ans += dp[N][i][1];
  }
  cout << ans % MOD << endl;
}
0