Submission #591479

#TimeUsernameProblemLanguageResultExecution timeMemory
591479piOOEFire (JOI20_ho_t5)C++17
0 / 100
108 ms262144 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, q; cin >> n >> q; vector<vector<int>> s(n + 1, vector<int>(n)); for (int i = 0; i < n; ++i) { cin >> s[0][i]; } for (int t = 1; t <= n; ++t) { for (int i = 0; i < n; ++i) { s[t][i] = max(s[t - 1][i], (i >= t ? s[t - 1][i - t] : 0)); } } while (q--) { int t, l, r; cin >> t >> l >> r; ll ans = 0; for (int i = l - 1; i < r; ++i) { ans += s[t][i]; } cout << ans << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...