# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
798234 | alittlemiddle | Race (IOI11_race) | C++14 | 670 ms | 49564 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>
#include "race.h"
using namespace std;
const int MX = 1e6;
vector<vector<pair<int,int>>> g;
vector<int> sz, dead;
int dfs_sz(int v, int p){
sz[v] = 1;
for(auto [u, w]: g[v]) if(u != p && !dead[u]){
sz[v] += dfs_sz(u, v);
}
return sz[v];
}
int cent(int v, int p, int n){
for(auto [u, w]: g[v]) if(u != p && !dead[u] && sz[u] > n / 2){
return cent(u, v, n);
}
return v;
}
void dfs(int v, int p, int ws, vector<pair<int,int>> &ps, int ln){
if(ws > MX) return;
ps.emplace_back(ws, ln);
for(auto [u, w]: g[v]) if(u != p && !dead[u]){
dfs(u, v, ws + w, ps, ln + 1);
}
}
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... |