# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305039 | vipghn2003 | Race (IOI11_race) | C++14 | 567 ms | 83192 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 fi first
#define se second
#define pii pair<int,int>
using namespace std;
const int N=2e5+5;
int res,k;
map<int,int>mp[N];
vector<pii>adj[N];
void dfs(int u,int p=-1,int h=0,int w=0)
{
mp[u][w]=h;
int tmp=u;
for(auto&to:adj[u])
{
int v=to.fi;
if(v==p) continue;
dfs(v,tmp,h+1,w+to.se);
if(mp[u].size()<mp[v].size()) swap(mp[u],mp[v]);
for(auto&x:mp[v])
{
if(mp[u].count(k+2*w-x.fi))
{
res=min(res,x.se+mp[u][k+2*w-x.fi]-2*h);
}
}
for(auto&x:mp[v])
{
# | 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... |