# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
477026 | mychecksedad | Putovanje (COCI20_putovanje) | C++17 | 119 ms | 37816 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;
typedef long long int ll;
#define pb push_back
#define all(x) x.begin(), x.end()
const int N = 2e5 + 10, M = 1e5+10, F = 2147483646, K = 20;
int n, a, b, depth[N], timein[N], lca[4*N][K];
vector<pair<int, pair<ll, ll>>> g[N];
vector<int> euler;
pair<int, int> s[N];
ll ans = 0, m[N], sum = 0;
void dfs(int v, int p, int d){
depth[v] = d;
timein[v] = int(euler.size());
euler.pb(v);
for(auto k: g[v]){
if(k.first != p){
dfs(k.first, v, d + 1);
euler.pb(v);
}
}
}
int mx(int l, int r){
int k = __lg(r - l + 1);
if(depth[lca[l][k]] < depth[lca[r - (1<<k) + 1][k]])
return lca[l][k];
return lca[r - (1<<k) + 1][k];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |