# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
674299 | lam | Race (IOI11_race) | C++14 | 1781 ms | 75872 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;
typedef pair<long long,long long> ii;
#define ff first
#define ss second
const long long maxn = 1e6 + 10;
map<long long,long long> mp;
long long n;
long long k;
vector <ii> adj[maxn];
long long s[maxn],dau[maxn];
long long ans = 1e9;
long long get_sz(long long x, long long p)
{
s[x]=1;
for (ii i:adj[x])
if (i.ff!=p&&!dau[i.ff]) s[x]+=get_sz(i.ff,x);
return s[x];
}
long long find_centroid(long long x, long long p, long long sz)
{
for (ii i:adj[x])
if (i.ff!=p&&!dau[i.ff]&&s[i.ff]*2>sz) return find_centroid(i.ff,x,sz);
return x;
}
void dfs(long long x, long long p, long long val, long long depth)
{
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |