# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
857791 | caohung06 | Putovanje (COCI20_putovanje) | C++17 | 103 ms | 34640 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>
#define ll long long
#define f first
#define s second
using namespace std;
vector<pair<ll,ll>> g[100050];
ll p[100050][22],h[100050],n,u,v,c1[100050],c2[100050],dem[100050],d[100050],ans;
ll getbit(ll x,ll k)
{
return (x>>k)&1;
}
void dfs(int u)
{
for(int v=0; v<g[u].size(); v++)
{
if(g[u][v].f!=p[u][0])
{
h[g[u][v].f]=h[u]+1;
p[g[u][v].f][0]=u;
for(int i=1; i<=18; i++)
{
p[g[u][v].f][i]=p[p[g[u][v].f][i-1]][i-1];
}
dfs(g[u][v].f);
}
}
}
ll lca(int u,int v)
{
if(h[u]<h[v]) swap(u,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... |