# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
941455 | Mike_Vu | Race (IOI11_race) | C++14 | 218 ms | 53324 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;
const int MAX = 1e6 + 5;
const int inf = 1e9;
int n, k, res = inf, sz[MAX], min_length[MAX];
bool deleted[MAX];
vector<int> undo_length;
vector<pair<int, int>> adj[MAX];
stack<pair<int, int>> updates;
int get_size(int u, int pre){
sz[u] = 1;
for(auto [v, w] : adj[u]) if(v != pre and !deleted[v]){
sz[u] += get_size(v, u);
}
return sz[u];
}
int find_centroid(int u, int pre, int target){
for(auto [v, w] : adj[u]) if(v != pre and !deleted[v] and sz[v] * 2 > target){
return find_centroid(v, u, target);
}
return u;
}
void compute(int u, int pre, int len, int sum){
if(sum > k) return;
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... |