(int x)
| 333 | } |
| 334 | |
| 335 | public static void off(int x) { |
| 336 | delAns(x); |
| 337 | sonMax[x].add(0); |
| 338 | addAns(x); |
| 339 | for (int u = x, fa = centfa[u]; fa > 0; u = fa, fa = centfa[u]) { |
| 340 | delAns(fa); |
| 341 | if (distFa[u].size() > 0) { |
| 342 | sonMax[fa].del(distFa[u].first()); |
| 343 | } |
| 344 | distFa[u].add(getDist(x, fa)); |
| 345 | sonMax[fa].add(distFa[u].first()); |
| 346 | addAns(fa); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | public static void prepare() { |
| 351 | for (int i = 1; i <= n; i++) { |