# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
342683 | saketh | Deda (COCI17_deda) | C++17 | 109 ms | 6892 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.
// segment_tree {{{
#include <vector>
#include <cassert>
template<typename T, typename AssociativeOperation>
struct segment_tree {
int SZ;
T identity;
AssociativeOperation TT;
std::vector<T> data;
segment_tree() {}
segment_tree(int _SZ, T _identity, AssociativeOperation _TT)
: SZ(_SZ), identity(_identity), TT(_TT) {
data.resize(2 * SZ, identity);
}
// Returns the value at index i
const T& operator[](int i) const {
assert(0 <= i && i < SZ);
return data[SZ + i];
}
// Assigns fn(i) at index i for each i in [0, SZ)
template<typename Function>
void assign(Function fn) {
for (int i = 0; i < SZ; i++)
data[SZ + i] = fn(i);
for (int i = SZ - 1; i; i--)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |