# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
935222 | Bula | Race (IOI11_race) | C++17 | 4 ms | 9560 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;
//#define int long long
const int mod = 1e9 + 7, N = 2e5 + 5;
int n, k, ans = INT_MAX;
vector<int> adj[N], subtree_size(N);
vector<bool> is_removed(N);
vector<pair<int, int>> cur;
map<pair<int, int>, int> l;
void dfs(int v, int par, int dist, int edge){
if(dist > k || edge > ans) return;
cur.push_back({dist, edge});
for(auto to : adj[v]){
if(to == par || is_removed[to]) continue;
dfs(to, v, dist + l[{v, to}], edge + 1);
}
}
int get_subtree_size(int node, int parent = -1) {
subtree_size[node] = 1;
for (int child : adj[node]) {
if (child == parent || is_removed[child]) { continue; }
subtree_size[node] += get_subtree_size(child, node);
}
return subtree_size[node];
}
int get_centroid(int node, int tree_size, int parent = -1) {
for (int child : adj[node]) {
# | 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... |