# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
712937 | iskhakkutbilim | Putovanje (COCI20_putovanje) | C++14 | 428 ms | 46612 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 int long long
#define all(a) a.begin(), a.end()
const int N = 2e5;
const int LOG = 20;
int up[N+1][LOG+1], depth[N+1];
int tin[N+1], tout[N+1];
int bigchild[N+1], chain[N+1], pos[N];
int sub[N+1];
vector<pair<int, int> > g[N+1];
int n, q, T, position;
void dfs(int v, int p){
tin[v] = ++T;
up[v][0] = p;
for(int j = 1;j < LOG; j++) up[v][j] = up[up[v][j-1]][j-1];
sub[v] = 1;
int big=-1;
for(auto [to, w] : g[v]){
if(to != p){
depth[to] = depth[v]+1;
dfs(to, v);
sub[v]+= sub[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... |