# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1071333 | vjudge1 | Addk (eJOI21_addk) | C++17 | 2024 ms | 3920 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 <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() {
cin >> n >> K;
for (int i = 1; i <= n; ++i)
cin >> a[i];
vector<ll> pref(n + 1);
pref[0] = 0;
for (int i = 1; i <= n; ++i)
pref[i] = pref[i - 1] + a[i];
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;
ll ans = 0;
int tl = l-1, tr = l + m - 1;
while (tr <= r) {
ans += pref[tr++] - pref[tl++];
}
cout << ans << '\n';
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |