#include <bits/stdc++.h>
#include <random>
#include <chrono>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//typedef pair<double,double> pdd;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T> void _do(T x){cerr<<x<<"\n";}
template<typename T,typename ...U> void _do(T x,U ...y){cerr<<x<<", ";_do(y...);}
#define dbg(...) cerr<<#__VA_ARGS__<<" = ";_do(__VA_ARGS__);
const int MOD1=1e9+7;
const int MOD2=998244353;
const ll INF=3e18;
const ld PI=3.14159265358979323846;
ll gcd(ll a,ll b){if(b==0) return a; return gcd(b,a%b);}
ll fpow(ll a,ll b,ll m)
{
if(!b) return 1;
ll ans=fpow(a*a%m,b/2,m);
return (b%2?ans*a%m:ans);
}
ll inv(ll a,ll m) {return fpow(a,m-2,m);}
#define MottoHayaku ios::sync_with_stdio(false);cin.tie(0);
//#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repk(i,m,n) for(int i=m;i<n;i++)
#define F first
#define S second
#define pb push_back
#define uni(c) c.resize(distance(c.begin(),unique(c.begin(),c.end())))
#define unisort(c) sort(c.begin(),c.end()),uni(c)
const int N=1e5+5;
vector<int> ed[N];
pii e[N];
int n,m,q,bit[N*2],tin[N*2],tout[N*2],an[N][20],ti=1;
int a[N],last[N];
bool state[N];
void upd(int x,int val)
{
for(;x<N*2;x+=x&-x) bit[x]+=val;
}
int qry(int x)
{
int ret=0;
for(;x;x-=x&-x) ret+=bit[x];
return ret;
}
void dfs(int u,int p)
{
tin[u]=ti++;
an[0][u]=p;
for(int v:ed[u]) if(v!=p) dfs(v,u);
tout[u]=ti++;
}
int croot(int x)
{
int r=x,tot=qry(tin[x]);
for(int i=18;i>=0;i--)
{
if(an[i][r]&&qry(tin[an[i][r]])==tot) r=an[i][r];
}
return r;
}
void getans(int u,int p)
{
if(state[u]) a[u]=a[p];
for(int v:ed[u]) if(v!=p) getans(v,u);
}
signed main()
{
MottoHayaku
cin>>n>>m>>q;
rep1(i,n-1)
{
int u,v;
cin>>u>>v;
ed[u].pb(v);
ed[v].pb(u);
e[i]={u,v};
}
dfs(1,0);
rep1(i,18) rep1(j,n) an[i][j]=an[i-1][an[i-1][j]];
rep1(i,n)
{
a[i]=1;
last[i]=1;
upd(tin[i],-1);
upd(tout[i],1);
}
while(m--)
{
int id;
cin>>id;
int u=e[id].F,v=e[id].S;
if(an[0][u]==v) swap(u,v);
int h=croot(u);
if(state[v])
{
last[v]=0;
a[v]=a[h];
upd(tin[v],-1);
upd(tout[v],1);
}
else
{
a[h]+=last[v];
last[h]+=last[v];
upd(tin[v],1);
upd(tout[v],-1);
}
state[v]=!state[v];
}
getans(1);
while(q--)
{
int u;
cin>>u;
cout<<a[u]<<"\n";
}
}
Compilation message
synchronization.cpp: In function 'int main()':
synchronization.cpp:124:13: error: too few arguments to function 'void getans(int, int)'
124 | getans(1);
| ^
synchronization.cpp:75:6: note: declared here
75 | void getans(int u,int p)
| ^~~~~~