()
| 81 | } |
| 82 | |
| 83 | public static void prepare() { |
| 84 | for (int i = 1; i <= n; i++) { |
| 85 | sorted[i] = node[i]; |
| 86 | } |
| 87 | Arrays.sort(sorted, 1, n + 1); |
| 88 | s = 1; |
| 89 | for (int i = 2; i <= n; i++) { |
| 90 | if (sorted[s] != sorted[i]) { |
| 91 | sorted[++s] = sorted[i]; |
| 92 | } |
| 93 | } |
| 94 | for (int i = 1; i <= n; i++) { |
| 95 | node[i] = kth(node[i]); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | public static void addEdge(int u, int v) { |
| 100 | next[++cntg] = head[u]; |