# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
957438 | Haidara314 | 경주 (Race) (IOI11_race) | C++17 | 320 ms | 78672 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "race.h"
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
using namespace std;
int ans=1e9;
int k;
vector<pair<int,int>>adj[200005];
ll dep[200005];
int dis[200005];
map<ll,int> dfs(int u,int p)
{
map<ll,int>y;
y[dep[u]]=dis[u];
for(auto x:adj[u])
{
if(x.F!=p)
{
dep[x.F]=dep[u]+x.S;
dis[x.F]=dis[u]+1;
map<ll,int>j=dfs(x.F,u);
if(j.size()>=y.size())
swap(j,y);
for(auto f:j)
{
if(f.F-dep[u]<=k&&y.count(k-f.F+2*dep[u]))
{
ans=min(ans,y[k-f.F+2*dep[u]]+f.S-2*dis[u]);
}
# | 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... |