# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92052 | Kamisama | Election Campaign (JOI15_election_campaign) | C++14 | 409 ms | 27768 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 <iostream>
#include <vector>
using namespace std;
const int maxn=1e5+7;
int n,m;
int par[maxn],lv[maxn],f[maxn][18];
int in[maxn],out[maxn],bit[maxn],dp[maxn];
vector<int> adj[maxn],road[maxn];
struct Query{int a,b,c;}q[maxn];
inline void Dfs(const int &u,const int &p){
static int nVisit=0;
in[u]=++nVisit;
par[u]=p;
lv[u]=lv[p]+1;
f[u][0]=p;
for(int i=1;i<18;i++) f[u][i]=f[f[u][i-1]][i-1];
for(int v: adj[u]) if(v!=p) Dfs(v,u);
out[u]=nVisit;
}
inline int Jump(int u,int k){
for(int cur=0;k;k>>=1,cur++) if(k&1) u=f[u][cur];
return u;
}
inline int Lca(int u,int v){
if(lv[u]>lv[v]) swap(u,v);
# | 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... |