# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1146469 | aliarapov | Easter Eggs (info1cup17_eastereggs) | C++20 | 12 ms | 464 KiB |
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int n = 513;
vector<int> g[n];
vector<int> sz(n);
vector<int> par(n);
vector<bool> bad(n);
void dfs(int v) {
for (int to : g[v]) {
if (to != par[v]) par[to] = v, dfs(to);
}
}
void getsz(int v) {
sz[v] = 1;
for (int to : g[v]) {
if (to != par[v] and !bad[to]) getsz(to), sz[v] += sz[to];
}
}
int get(int v, int root) {
for (int to : g[v]) {
if (to != par[v] and sz[to] * 2 >= sz[root] and !bad[to]) return get(to, root);
}
return 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... |