# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
845896 | sebinkim | Beech Tree (IOI23_beechtree) | C++17 | 752 ms | 222668 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>
#include "beechtree.h"
using namespace std;
using pii = pair<int, int>;
using piii = tuple<int, int, int>;
vector<int> T[202020], C;
priority_queue<piii> Q;
int S[202020], I[202020];
set<pii> P1[202020];
set<piii> P2[202020];
int n, m;
bool dfs(int u, vector<int> &A) {
bool f = 1;
P1[u].emplace(I[u], u);
for (int &v: T[u]) {
auto it = P2[u].emplace(C[v], I[v], u).first;
if (it != P2[u].begin() && get<0>(*prev(it)) == C[v]) f = 0;
if (next(it) != P2[u].end() && get<0>(*next(it)) == C[v]) f = 0;
}
for (int &v: T[u]) {
f &= dfs(v, A);
if (P1[u].size() < P1[v].size()) {
swap(P1[u], P1[v]); swap(P2[u], P2[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... |
# | 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... |