# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1096171 | Sunbae | Putovanje (COCI20_putovanje) | C++17 | 1062 ms | 18772 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>
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
tuple<int,int,int,int> E[N];
vector<int> g[N];
int sz[N], up[N], dep[N], pos[N], idx[N], top[N], s[N<<2], ti, L, R, n;
void init(int ind, int low, int high){
if(low == high){ idx[low] = ind; return;}
int mid = low + ((high-low)>>1);
init(ind<<1, low, mid); init(ind<<1|1, mid+1, high);
}
void upd(int ind, int low, int high){
if(low > R || high < L) return;
if(L <= low && high <= R){ ++s[ind]; return;}
int mid = low + ((high-low)>>1);
upd(ind<<1, low, mid); upd(ind<<1|1, mid+1, high);
}
void dfs(int u){
sz[u] = 1;
for(int& v: g[u]){
g[v].erase(find(g[v].begin(), g[v].end(), up[v] = u));
dep[v] = dep[u] + 1; dfs(v); sz[u] += sz[v];
if(sz[v] > sz[g[u][0]]) swap(v, g[u][0]);
}
}
void efs(int u){
pos[u] = ti++;
for(int v: g[u]){
top[v] = (u == g[u][0]) ? top[u] : 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... |