# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1042213 | Lucpp | Petrol stations (CEOI24_stations) | C++17 | 1392 ms | 189180 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;
#define all(x) (x).begin(), (x).end()
using ll = long long;
constexpr int NODES = 11e6;
constexpr ll MAX = 1ll << 46;
ll seg[NODES];
int L[NODES], R[NODES];
int nxtNode = 1;
int upd(ll p, ll x, int i, ll l = 0, ll r = MAX){
int node = nxtNode++;
seg[node] = seg[i];
L[node] = L[i];
R[node] = R[i];
if(l+1 == r) seg[node] += x;
else{
ll m = (l + r) / 2;
if(p < m) L[node] = upd(p, x, L[i], l, m);
else R[node] = upd(p, x, R[i], m, r);
seg[node] = seg[L[node]] + seg[R[node]];
}
return node;
}
ll qry(ll ql, ll qr, int i, ll l = 0, ll r = MAX){
if(i == 0) return 0;
if(ql <= l && r <= qr) return seg[i];
if(r <= ql || qr <= l) return 0;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |