# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
832184 | vjudge1 | Addk (eJOI21_addk) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int nmax = 1e5+5;
int main() {
int n,k,q;
cin >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> a[i];
p[i] = a[i] + p[i - 1];
}
cin >> q;
while (q--) {
int t;
cin >> t;
if (t == 1) {
cin >> idx[1];
} else
if (t == 2) {
int l, r, m;
cin >> l >> r >> m;
long long ans = 0;
for (int i = l; i <= r; i++) {
f (i - l + 1 >= m) {
ans += p[i] - p[i - m];
}
}
cout << ans << endl;
}
}
return 0;
}