# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
890618 | iskhakkutbilim | Election Campaign (JOI15_election_campaign) | C++17 | 142 ms | 32336 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 ff first
#define ss second
#define all(a) a.begin(), a.end()
const int N = 100000;
int n;
vector<int> g[N+5];
int timer, depth[N+10], sub[N+10];
int up[N + 10][18], bigchild[N+10], chain[N+10];
int tin[N+10], tout[N+10], pos[N+10];
void dfs(int v, int par){
up[v][0] = par;
tin[v] = timer++;
sub[v] = 1;
for(int j = 1; j < 18; j++){
up[v][j] = up[up[v][j-1]][j-1];
}
for(int to : g[v]){
if(to == par) continue;
depth[to] = depth[v] + 1;
dfs(to, v);
sub[v]+= sub[to];
if(bigchild[v] == 0 || sub[bigchild[v]] < sub[to]){
bigchild[v] = to;
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |