結果
問題 |
No.314 ケンケンパ
|
ユーザー |
![]() |
提出日時 | 2024-02-24 14:45:52 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 66 ms / 1,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 4,406 ms |
コンパイル使用メモリ | 312,700 KB |
実行使用メモリ | 57,988 KB |
最終ジャッジ日時 | 2024-09-29 10:01:47 |
合計ジャッジ時間 | 5,412 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; using namespace chrono; #if __has_include(<atcoder/all>) #include <atcoder/all> using namespace atcoder; #endif int main() { int64_t n; cin >> n; using mint = modint1000000007; vector dp(n + 1, vector(3, mint(0))); dp[0][0] = 1; for (int64_t i = 0; i < n; i++) { dp[i + 1][0] += dp[i][1] + dp[i][2]; dp[i + 1][1] += dp[i][0]; dp[i + 1][2] += dp[i][1]; } cout << (dp[n][0] + dp[n][1] + dp[n][2]).val() << endl; return 0; }