結果
問題 | No.1331 Moving Penguin |
ユーザー | SSRS |
提出日時 | 2021-01-08 21:53:31 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 656 bytes |
コンパイル時間 | 1,544 ms |
コンパイル使用メモリ | 177,812 KB |
実行使用メモリ | 646,320 KB |
最終ジャッジ日時 | 2024-04-28 02:46:07 |
合計ジャッジ時間 | 5,041 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | MLE | - |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 50 ms
15,360 KB |
testcase_05 | TLE | - |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | AC | 37 ms
21,548 KB |
testcase_09 | AC | 37 ms
21,700 KB |
testcase_10 | AC | 39 ms
21,608 KB |
testcase_11 | AC | 45 ms
28,000 KB |
testcase_12 | AC | 44 ms
27,996 KB |
testcase_13 | AC | 45 ms
27,880 KB |
testcase_14 | AC | 117 ms
71,592 KB |
testcase_15 | AC | 113 ms
71,532 KB |
testcase_16 | AC | 118 ms
71,500 KB |
testcase_17 | AC | 32 ms
20,256 KB |
testcase_18 | AC | 33 ms
19,704 KB |
testcase_19 | AC | 30 ms
17,452 KB |
testcase_20 | AC | 31 ms
18,108 KB |
testcase_21 | AC | 33 ms
19,864 KB |
testcase_22 | AC | 34 ms
19,696 KB |
testcase_23 | AC | 65 ms
40,292 KB |
testcase_24 | AC | 66 ms
40,480 KB |
testcase_25 | AC | 65 ms
40,480 KB |
testcase_26 | AC | 140 ms
42,240 KB |
testcase_27 | AC | 130 ms
41,636 KB |
testcase_28 | AC | 144 ms
46,372 KB |
testcase_29 | AC | 53 ms
9,180 KB |
testcase_30 | AC | 35 ms
14,720 KB |
testcase_31 | AC | 70 ms
26,852 KB |
testcase_32 | AC | 30 ms
12,288 KB |
testcase_33 | AC | 46 ms
19,200 KB |
testcase_34 | AC | 78 ms
27,904 KB |
testcase_35 | MLE | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; int main(){ int N; cin >> N; vector<int> A(N); for (int i = 0; i < N; i++){ cin >> A[i]; } vector<long long> dp(N, 0); dp[0] = 1; vector<map<int, long long>> next(N); for (int i = 0; i < N; i++){ for (auto P : next[i]){ dp[i] += P.second; dp[i] %= MOD; if (i + P.first < N){ next[i + P.first][P.first] += P.second % MOD; } } if (i < N - 1 && A[i] != 1){ dp[i + 1] += dp[i]; dp[i + 1] %= MOD; } if (i + A[i] < N){ next[i + A[i]][A[i]] += dp[i]; } } cout << dp[N - 1] << endl; }