結果

問題 No.314 ケンケンパ
ユーザー achapiachapi
提出日時 2023-04-23 09:44:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 513 bytes
コンパイル時間 4,831 ms
コンパイル使用メモリ 258,748 KB
実行使用メモリ 18,812 KB
最終ジャッジ日時 2024-04-25 07:34:33
合計ジャッジ時間 8,274 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using mint = atcoder::modint1000000007;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<vector<mint>> dp(3, vector<mint> (n + 1));
	dp[0][0] = 1;
	for (int i = 1; i < n; i++){
		for (int j = 1; j < 2; j++){
			dp[j][i] += dp[j - 1][i - 1];
		}
		for (int j = 0; j < 2; j++){
			dp[2][i] += dp[j][i - 1];
		}
		dp[0][i] += dp[2][i - 1];
		cout << endl;
	}
	mint ans;
	for (int i = 0; i < 3; i++){
		ans += dp[i][n - 1];
	}
	cout << ans.val() << endl;
}
0