# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
868462 | t6twotwo | Two Currencies (JOI23_currencies) | C++17 | 3030 ms | 166692 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;
using ll = long long;
template <class S, S (*f)(S, S), S e>
struct PST {
struct T {
T *l, *r; S s;
T() : s() {l = r = nullptr;}
T(const S &v) : s(v) {l = r = nullptr;}
T(T *t) : l(t->l), r(t->r), s(t->s) {}
T(T *a, T *b) : l(a), r(b), s() {
if (l) s = f(s, l->s);
if (r) s = f(s, r->s);
}
};
int n;
vector<T*> rts;
PST(int m) : PST(vector<S>(m, e)) {
}
PST(const vector<S> &a) : n(a.size()) {
function<T*(int, int)> bld = [&](int l, int r) {
if (l + 1 == r) {
return new T(a[l]);
}
int m = (l + r) / 2;
return new T(bld(l, m), bld(m, r));
};
rts.push_back(bld(0, n));
}
T* set(T *i, int l, int r, int p, const S &v) {
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... |