# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
868468 | t6twotwo | Two Currencies (JOI23_currencies) | C++17 | 900 ms | 33572 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;
struct HLD {
bool e;
int n, timer;
vector<int> sz, dep, par, top, pos;
vector<vector<int>> adj;
HLD(int m, bool edge) : n(m), e(edge) {
sz.resize(n);
dep.resize(n);
top.resize(n);
pos.resize(n);
adj.resize(n);
par.resize(n);
}
void add_edge(int x, int y) {
adj[x].push_back(y);
adj[y].push_back(x);
}
void init(int x) {
sz[x] = 1;
for (int &y : adj[x]) {
dep[y] = dep[x] + 1;
adj[y].erase(find(adj[y].begin(), adj[y].end(), par[y] = x));
init(y);
sz[x] += sz[y];
if (sz[y] > sz[adj[x][0]]) {
swap(y, adj[x][0]);
}
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... |