結果
問題 |
No.533 Mysterious Stairs
|
ユーザー |
![]() |
提出日時 | 2021-03-05 02:38:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 93 ms / 5,000 ms |
コード長 | 591 bytes |
コンパイル時間 | 632 ms |
コンパイル使用メモリ | 71,784 KB |
実行使用メモリ | 57,856 KB |
最終ジャッジ日時 | 2024-10-05 18:00:26 |
合計ジャッジ時間 | 1,811 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <iostream> #include <vector> using namespace std; using ll = long long int; constexpr ll MOD = 1'000'000'007; int main(){ int n; cin >> n; vector<vector<ll>> memo(n+1, vector<ll>(3, 0)); memo[0][0] = memo[1][0] = 1; for(int i = 2; i <= n; i++){ for(int j = 0; j < 3; j++){ for(int k = 0; k < 3; k++){ if(i-j-1 < 0 || j == k) continue; memo[i][j] += memo[i-j-1][k]; memo[i][j] %= MOD; } } } cout << (memo[n][0] + memo[n][1] + memo[n][2])%MOD << endl; return 0; }