(int a, int b)
| 155 | } |
| 156 | |
| 157 | public static int lca(int a, int b) { |
| 158 | while (top[a] != top[b]) { |
| 159 | if (dep[top[a]] <= dep[top[b]]) { |
| 160 | b = fa[top[b]]; |
| 161 | } else { |
| 162 | a = fa[top[a]]; |
| 163 | } |
| 164 | } |
| 165 | return dep[a] <= dep[b] ? a : b; |
| 166 | } |
| 167 | |
| 168 | public static void main(String[] args) throws IOException { |
| 169 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); |