| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 475444 | keta_tsimakuridze | Addk (eJOI21_addk) | C++14 | 317 ms | 5792 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>
#define f first
#define s second
#define int long long
#define pii pair<int,int>
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7; // !
int t, n, q, a[N], tree[N];
void upd(int ind,int val) {
for(ind;ind <= n; ind += ind & (-ind)) tree[ind] += val;
}
int get(int ind) {
int ans = 0;
for(ind; ind >= 1; ind -= (ind) & (-ind)) ans += tree[ind];
return ans;
}
main(){
int K;
cin >> n >> K;
if(K > 1) return 0;
for(int i = 1; i <= n; i++) cin >> a[i], a[i] += a[i - 1], upd(i,a[i]);
int q;
cin >> q;
while(q--) {
int t;
cin >> t;
if(t == 1) {
int x;
cin >> x;
continue;
}
int l,r,m;
cin >> l >> r >> m;
cout << get(r) - get(l + m - 2) - (get(r - m) - get(l - 2)) << endl;
}
}
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... | ||||
