結果
| 問題 | No.533 Mysterious Stairs |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-23 18:51:05 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 61 ms / 5,000 ms |
| + 733µs | |
| コード長 | 516 bytes |
| 記録 | |
| コンパイル時間 | 2,996 ms |
| コンパイル使用メモリ | 179,580 KB |
| 実行使用メモリ | 57,884 KB |
| 最終ジャッジ日時 | 2026-10-23 18:51:11 |
| 合計ジャッジ時間 | 5,316 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(void){
int n; cin >> n;
vector dp(n+3, vector<ll>(3));
ll mod=1e9+7;
for(int i=1; i<=3; i++) dp[i][i-1]=1;
for(int i=1; i<=n; i++){
for(int p=0; p<3; p++)for(int q=0; q<3; q++)if(p!=q){
int ni=i+q+1;
if(ni<=n){
dp[ni][q]+=dp[i][p];
dp[ni][q]%=mod;
}
}
}
ll ans=0;
for(int i=0; i<3; i++) ans+=dp[n][i], ans%=mod;
cout << ans << endl;
return 0;
}