# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
696391 | sharaelong | Holiday (IOI14_holiday) | C++17 | 539 ms | 7264 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 "holiday.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
struct SegmentTree {
int n, h;
vector<ll> base;
vector<int> cnt;
vector<ll> sum;
SegmentTree() {}
SegmentTree(int _n, const vector<ll>& arr) : n(_n) {
h = Log2(n);
n = 1 << h;
base.resize(2*n, 0);
for (int i=0; i<arr.size(); ++i) base[n+i] = arr[i];
cnt.resize(2*n, 0);
sum.resize(2*n, 0);
}
void update(int p, int v) {
p += n;
cnt[p] += v;
sum[p] += base[p] * v;
for (p/=2; p>0; p/=2) {
cnt[p] = cnt[2*p] + cnt[2*p+1];
sum[p] = sum[2*p] + sum[2*p+1];
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |