# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1122424 | fuwad | Race (IOI11_race) | C++14 | 4 ms | 4948 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;
using ll = long long;
#define all(v) (v).begin(), (v).end()
const ll oo = 1e17;
const int mod = 1e9+7; // 998244353;
const int maxn = 2e5;
vector<pair<ll, ll>> adj[maxn+1];
bool bad[maxn+1];
int subtree_size[maxn+1];
ll k, ans;
void dfs_ssz(int v, int p){
subtree_size[v]=1;
for(auto [c, w]: adj[v]){
if(c^p and !bad[c]){
dfs_ssz(c, v);
subtree_size[v]+=subtree_size[c];
}
}
}
int find_centroid(int v, int p, int sz){
for(auto [c, w]: adj[v]){
if(!bad[c] and c^p and subtree_size[c]*2>sz)
return find_centroid(c, v, sz);
}
return v;
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... |