# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
557184 | MilosMilutinovic | Inside information (BOI21_servers) | C++14 | 248 ms | 30428 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 pb push_back
#define mp make_pair
#define pii pair<int,int>
const int N=120050;
const int M=2*N;
const int L=20;
int n,q,op[M],x[M],y[M],par[N][L],dep[N],w[N],up[N],dw[N];
vector<pii> E[N];
void DFS1(int u,int p){
if(w[u]>w[p])dw[u]=dw[p],up[u]=p;
else up[u]=up[p],dw[u]=p;
dep[u]=dep[p]+1;
par[u][0]=p;
for(int i=1;i<L;i++)par[u][i]=par[par[u][i-1]][i-1];
for(auto e:E[u])if(e.first!=p){
w[e.first]=e.second;
DFS1(e.first,u);
}
}
int LCA(int u,int v){
if(dep[u]<dep[v])swap(u,v);
for(int i=L-1;~i;i--)if(dep[par[u][i]]>=dep[v])u=par[u][i];
for(int i=L-1;~i;i--)if(par[u][i]!=par[v][i])u=par[u][i],v=par[v][i];
return u==v?u:par[u][0];
}
int Lift(int u,int k){for(int i=L-1;i>=0;i--)if(k>>i&1)u=par[u][i];return u;}
bool conn(int u,int v,int t){
bool ok=true;
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... |
# | 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... |