# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
145004 | evpipis | Cat in a tree (BOI17_catinatree) | C++14 | 105 ms | 20344 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;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef pair<int, int> ii;
const int len = 2e5+5;
int n, d, dis[len], opt[len];
vector<int> adj[len];
bool comp(int a, int b){
return (dis[a] < dis[b]);
}
void dfs(int u){
//printf("dfs: u = %d\n", u);
for (int j = 0; j < adj[u].size(); j++){
int v = adj[u][j];
dfs(v);
dis[v]++;
}
sort(adj[u].begin(), adj[u].end(), comp);
opt[u] = 1;
dis[u] = 0;
int sum = 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... |