結果
問題 | No.533 Mysterious Stairs |
ユーザー | iqueue02 |
提出日時 | 2019-11-08 16:56:21 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 809 bytes |
コンパイル時間 | 1,442 ms |
コンパイル使用メモリ | 164,880 KB |
実行使用メモリ | 15,240 KB |
最終ジャッジ日時 | 2023-10-13 03:12:55 |
合計ジャッジ時間 | 3,007 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,352 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,352 KB |
testcase_03 | AC | 2 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,352 KB |
testcase_06 | AC | 2 ms
4,352 KB |
testcase_07 | AC | 1 ms
4,348 KB |
testcase_08 | AC | 1 ms
4,348 KB |
testcase_09 | AC | 1 ms
4,352 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 1 ms
4,352 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 25 ms
15,144 KB |
testcase_24 | AC | 24 ms
15,240 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 7 ms
6,340 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair<int,int> P; const int mod = 1e9+7; int dp[1000010][3]; int main(){ int n; cin >> n; dp[0][0] = 1; dp[0][1] = 1; dp[0][2] = 1; rep(i,n) { rep(j,3) { if (j == 0) { if (i+2<=n) (dp[i+2][1] += dp[i][j]) %= mod; if (i+3<=n) (dp[i+3][2] += dp[i][j]) %= mod; } if (j == 1) { if (i+1<=n) (dp[i+1][0] += dp[i][j]) %= mod; if (i+3<=n) (dp[i+3][2] += dp[i][j]) %= mod; } if (j == 2) { if (i+1<=n) (dp[i+1][0] += dp[i][j]) %= mod; if (i+2<=n) (dp[i+2][1] += dp[i][j]) %= mod; } } } cout << (dp[n][0] + dp[n][1] + dp[n][2]) % mod / 2 << endl; return 0; }