Submission #882197

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8821972023-12-02 19:18:27abcvuitunggioSynchronization (JOI13_synchronization)C++17
100 / 100
276 ms36372 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,m,q,x[100001],y[100001],d,c,last[100001],s[100001],res[100001],tin[100001],tout[100001],t,p[100001][20],ft[100001][2];
vector <int> ke[100001];
void update(int i, int j, int val){
for (;i<=n;i+=i&(-i))
ft[i][j]+=val;
}
int get(int i, int j){
int res=0;
for (;i;i-=i&(-i))
res+=ft[i][j];
return res;
}
int get(int u){
return get(tout[u],1)-get(tin[u]-1,1);
}
void dfs(int u, int par){
tin[u]=++t;
for (int v:ke[u])
if (v!=par){
p[v][0]=u;
for (int i=1;i<20;i++)
p[v][i]=p[p[v][i-1]][i-1];
dfs(v,u);
}
tout[u]=t;
}
int f(int u){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...