# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
476962 | David_M | Addk (eJOI21_addk) | C++14 | 236 ms | 10464 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 ll long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define FF first.first
#define FS first.second
#define pb push_back
using namespace std;
const ll N=1000006, INF=1e18, P=998244353;
ll q=1, n, m, x, y, z, l, r, k, t, a[N], b[N], f[N], ans, o, u, Ans[N];
pair<ll, ll> T[N];
void upd(int x, ll val, int v=1, int L=1, int R=n){
int M=L+R>>1;
if(L==R){T[v]={val,val*x};return;}
if(x<=M)upd(x, val, v<<1, L, M);
else upd(x, val, v<<1|1, M+1, R);
T[v]={T[v<<1].F+T[v<<1|1].F, T[v<<1].S+T[v<<1|1].S};
}
ll get(int l, int r, int v=1, int L=1, int R=n){
if(R<l || L>r)return 0;
if(L>=l && R<=r)return T[v].S-T[v].F*(l-1);
int M=L+R>>1;
return get(l, r, v<<1, L, M)+get(l, r, v<<1|1, M+1, R);
}
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... |