版本比较
题解 AT4826 【[ABC160F] Distributing Integers】
正文
增加 2 行删除 2 行
31 行未改动323334353636373839408 行未改动4950515253535455565715 行未改动31 行未改动int qpow (int a,int b) { int res=1; while (b) { if (b&1) {res=(1ll*res*a)%P;} a=(1ll*a*a)%P,b>>=1; a=(1ll*a*a)%P,b>>=1; } return res;}void dfs1 (int x,int fa) {8 行未改动}void dfs2 (int x,int fa) { for (int i=hd[x];i;i=nx[i]) { if (ver[i]==fa) {continue;} f[ver[i]]=(1ll*f[x]*((1ll*(n-siz[ver[i]])*qpow(siz[ver[i]],P-2))%P))%P; f[ver[i]]=(1ll*f[x]*((1ll*(n-siz[ver[i]])*qpow(siz[ver[i]],P-2))%P))%P; dfs2(ver[i],x); } return;}15 行未改动