# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
771022 | GordonRemzi007 | Addk (eJOI21_addk) | C++17 | 289 ms | 9508 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>
#define ll unsigned long long
using namespace std;
class SegmentTree {
ll n, i = 0;
vector<ll> seggy;
public:
SegmentTree(ll size):n(size) {
seggy = vector<ll>(2*n);
}
void build() {
for(ll i = n-1; i > 0; i--) seggy[i] = seggy[2*i]+seggy[2*i+1];
}
void push(ll x) {
seggy[n+i] = x;
i++;
}
void update(ll x, ll y) {
x+=n;
seggy[x] = y;
while(x > 1) {
x/=2;
seggy[x] = seggy[2*x]+seggy[2*x+1];
}
}
ll query(ll x, ll y) {
ll res = 0;
for(x+=n, y+=n+1; x<y; x/=2, y/=2) {
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... |