제출 #1303824

#제출 시각아이디문제언어결과실행 시간메모리
1303824123123123이주 (IOI25_migrations)C++20
0 / 100
84 ms6160 KiB
#include <bits/stdc++.h> using namespace std; int p[200005]; int send_message(int N, int i, int Pi) { p[i] = Pi; if(i == N - 1) { int mx = 1; vector <int> v[200005], depth(200005, 0); for(i = N; i > 0; i--) { v[p[i]].push_back(i); } auto dfs = [&](auto &dfs, int u, int p, int val = 0) -> void { depth[u] = val; for(int e : v[u]) { if(e != p) { dfs(dfs, e, u, val + 1); } } }; dfs(dfs, 0, 0); for(i = 2; i <= N; i++) { if(depth[i] > depth[mx]) { mx = i; } return mx; } } return 0; } pair <int, int> longest_path(vector <int> S) { return make_pair(0, S.back()); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...