# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1071440 |
2024-08-23T07:26:02 Z |
vjudge1 |
Addk (eJOI21_addk) |
C++17 |
|
388 ms |
1048576 KB |
#include <iostream>
#include <vector>
using namespace std;
using ll = long long int;
const int N = 100002;
ll n, K;
int a[N], q;
short int op;
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n >> K;
for (int i = 1; i <= n; ++i)
cin >> a[i];
vector<vector<ll>> pref(n + 1, vector<ll>(n + 1, 0));
for (int i = 1; i <= n; ++i)
pref[i][1] = pref[i - 1][1] + a[i];
for (int m = 2; m <= n; ++m)
for (int i = m; i <= n; ++i)
pref[i][m] = pref[i - 1][m] + pref[i][1] - pref[max(0, i-m)][1];
cout << endl;
for (int m = 1; m <= n; ++m) {
for (int i = 1; i <= n; ++i)
cout << pref[i][m] << ' ';
cout << endl;
}
q; cin >> q;
for (int tc = 1; tc <= q; ++tc) {
cin >> op;
if (op == 1) {
int x; cin >> x;
continue;
}
else {
int l, r, m;
cin >> l >> r >> m;
cout << pref[r][m] - pref[l+m-2][m] << '\n';
}
}
return 0;
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:34:2: warning: statement has no effect [-Wunused-value]
34 | q; cin >> q;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
376 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
388 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |