# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148104 | WhipppedCream | Cat in a tree (BOI17_catinatree) | C++17 | 319 ms | 51732 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.
//Power Of Ninja Go
#include <bits/stdc++.h>
//#ifdef atom #else #endif
using namespace std;
typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector< ii > vii;
#define X first
#define Y second
#define pb push_back
int n, k;
const int maxn = 2e5+5;
vi adj[maxn];
int h[maxn];
multiset<int> bst[maxn];
void dfs(int u)
{
for(auto v : adj[u])
{
h[v] = 1+h[u];
dfs(v);
}
}
void solve(int u)
{
for(auto v : adj[u]) solve(v);
int big = -1;
for(auto v : adj[u])
{
if(big == -1 || bst[v].size()> bst[big].size()) big = v;
}
if(big == -1) return;
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... |