# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1130324 | brover29 | Hard route (IZhO17_road) | C++20 | 2094 ms | 1604 KiB |
#include <bits/stdc++.h>
//qwerty47924692
using namespace std;
using ll = long long;
const ll N=5005;
const string br="617283";
#define sz(a)(ll)a.size()
#define f first
#define s second
ll n,tin[N],tout[N],timer,pr[20][N],h[N];
vector<ll>g[N],ch;
void dfs(ll v){
tin[v]=++timer;
for(ll i=1;i<=19;i++){
pr[i][v]=pr[i-1][pr[i-1][v]];
}
for(ll to:g[v]){
if(to==pr[0][v])continue;
pr[0][to]=v;
h[to]=h[v]+1;
dfs(to);
}
tout[v]=timer;
if(g[v].size()==1){
ch.push_back(v);
}
}
bool is_parent(ll x,ll y){
return (tin[x]<=tin[y]&&tout[y]<=tout[x]);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |