Submission #868462

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8684622023-10-31 13:45:47t6twotwoTwo Currencies (JOI23_currencies)C++17
100 / 100
3030 ms166692 KiB
#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) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

currencies.cpp: In constructor 'HLD::HLD(int, bool)':
currencies.cpp:84:9: warning: 'HLD::n' will be initialized after [-Wreorder]
   84 |     int n, timer;
      |         ^
currencies.cpp:83:10: warning:   'bool HLD::e' [-Wreorder]
   83 |     bool e;
      |          ^
currencies.cpp:87:5: warning:   when initialized here [-Wreorder]
   87 |     HLD(int n, bool edge) : n(n), e(edge) {
      |     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...