# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43689 | evpipis | Race (IOI11_race) | C++11 | 0 ms | 0 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;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> ii;
const int len = 2e5+5, inf = 1e9;
vector<ii> adj[len];
map<ll, int> *cnt, *help;
int ans = inf, sz[len], dep[len], p[len], n, k, isbig[len];
ll shift[len];
void fix(int u, int d){
sz[u] = 1;
dep[u] = d;
for (auto v: adj[u])
if (v.fi != p[u]){
p[v.fi] = u;
fix(v.fi, d+1);
sz[u] += sz[v.fi];
}
}
void add(int u, int x, int cur, ll dis){
if (x == 0 && (*help).count(k-dis-shift[cur]))
ans = min(ans, dep[u]+(*help)[k-dis-shift[cur]]-2*dep[cur]);