# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
475543 | lukameladze | Addk (eJOI21_addk) | C++14 | 347 ms | 5024 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 int long long
#define s second
#define pb push_back
using namespace std;
const int N = 5e5 + 5;
int le1,ri1,pr[N],sf[N],pr1[N],a[N],q,n,ty,le,ri,m,ans,idx[N],k;
int tree[3][N + 100];
void update(int idx, int val, int id) {
for (int i = idx; i < N; i += i&(-i)) {
tree[id][i] += val;
}
}
int getans(int idx, int id) {
int pas = 0;
for (int i = idx; i > 0; i-=i&(-i)) {
pas += tree[id][i];
}
return pas;
}
int getanss(int le , int ri) {
if (le > ri) return 0;
return getans(ri,0) - getans(le - 1,0);
}
int getans1(int le, int ri) {
if (le > ri) return 0;
return getans(ri,1) - getans(le - 1,1) - (le - 1) * getanss(le,ri);
}
int getans2(int le, int ri) {
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... |