# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
465514 | palilo | 조개 줍기 (KOI17_shell) | C++17 | 494 ms | 26788 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;
template <typename T>
class binary_indexed_tree {
const size_t n;
vector<T> tree;
public:
binary_indexed_tree(size_t n) : n(n), tree(n + 1) {}
// a[i] += val
void update(size_t i, T val) {
assert(0 <= i and i <= n);
for (++i; i <= n; i += i & -i)
tree[i] += val;
}
// sum in range [0...i)
T query(size_t i) const {
assert(0 <= i and i <= n);
T ret = 0;
for (; i; i &= i - 1)
ret += tree[i];
return ret;
}
};
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
#ifdef palilo
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |