# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448466 | nickyrio | Financial Report (JOI21_financial) | C++17 | 373 ms | 14464 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;
const int N = 3e5 + 100;
int a[N], f[N], IT[N << 2], perm[N], kount[N], rightMost[N], leftMost[N];
void Update(int k, int l, int r, int u, int v) {
if (l == r) { IT[k] = v; return; }
int m = l + r >> 1;
if (u <= m) Update(k << 1, l, m, u, v);
else Update(k << 1 | 1, m + 1, r, u, v);
IT[k] = max(IT[k << 1], IT[k << 1 | 1]);
}
int Query(int k, int l, int r, int u, int v) {
if (l > v || r < u) return 0;
if (u <= l && r <= v) return IT[k];
int m = (l + r) >> 1;
return max(Query(k << 1, l, m, u, v), Query(k << 1 | 1, m + 1, r, u, v));
}
int root(int u) { return (kount[u] < 0 ? u : kount[u] = root(kount[u])); }
void Union(int u, int v) {
// cerr << "Union" << u << ' ' << v << '\n';
u = root(u), v = root(v);
if (u == v) return;
int t = kount[u] + kount[v];
if (kount[u] > kount[v]) swap(u, 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |