(int x)
| 318 | } |
| 319 | |
| 320 | public static void on(int x) { |
| 321 | delAns(x); |
| 322 | sonMax[x].del(0); |
| 323 | addAns(x); |
| 324 | for (int u = x, fa = centfa[u]; fa > 0; u = fa, fa = centfa[u]) { |
| 325 | delAns(fa); |
| 326 | sonMax[fa].del(distFa[u].first()); |
| 327 | distFa[u].del(getDist(x, fa)); |
| 328 | if (distFa[u].size() > 0) { |
| 329 | sonMax[fa].add(distFa[u].first()); |
| 330 | } |
| 331 | addAns(fa); |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | public static void off(int x) { |
| 336 | delAns(x); |