# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
849175 | abcvuitunggio | Race (IOI11_race) | C++17 | 315 ms | 80208 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 "race.h"
#include <bits/stdc++.h>
using namespace std;
vector <pair <int, int>> ke[200001];
map <long long, long long> mp[200001];
long long k,len[200001],res=1e9,d[200001];
void dfs(int u, int p){
int bigchild=-1,sz=0;
for (auto [v,w]:ke[u])
if (v!=p){
d[v]=d[u]+1;
len[v]=len[u]+w;
dfs(v,u);
if (mp[v].size()>sz){
sz=mp[v].size();
bigchild=v;
}
}
if (bigchild!=-1)
swap(mp[u],mp[bigchild]);
for (auto [v,w]:ke[u]){
if (v!=bigchild){
for (auto [l,h]:mp[v])
if (mp[u].count(k+len[u]*2-l))
res=min(res,mp[u][k+len[u]*2-l]+h-d[u]*2);
for (auto [l,h]:mp[v])
if (!mp[u].count(l))
mp[u][l]=h;
else
mp[u][l]=min(mp[u][l],h);
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |