(String[] args)
| 208 | } |
| 209 | |
| 210 | public static void main(String[] args) { |
| 211 | FastIO io = new FastIO(System.in, System.out); |
| 212 | n = io.nextInt(); |
| 213 | m = io.nextInt(); |
| 214 | q = io.nextInt(); |
| 215 | for (int i = 1; i <= n; i++) { |
| 216 | node[i] = io.nextInt(); |
| 217 | } |
| 218 | for (int i = 1; i <= m; i++) { |
| 219 | edge[i][0] = io.nextInt(); |
| 220 | edge[i][1] = io.nextInt(); |
| 221 | edge[i][2] = io.nextInt(); |
| 222 | } |
| 223 | prepare(); |
| 224 | kruskalRebuild(); |
| 225 | for (int i = 1; i <= cntu; i++) { |
| 226 | if (i == father[i]) { |
| 227 | dfs(i, 0); |
| 228 | } |
| 229 | } |
| 230 | root[0] = build(1, s); |
| 231 | for (int i = 1; i <= n; i++) { |
| 232 | root[i] = insert(node[leafseg[i]], 1, s, root[i - 1]); |
| 233 | } |
| 234 | for (int i = 1, u, x, k, lastAns = 0; i <= q; i++) { |
| 235 | u = io.nextInt(); |
| 236 | x = io.nextInt(); |
| 237 | k = io.nextInt(); |
| 238 | u = (u ^ lastAns) % n + 1; |
| 239 | x = x ^ lastAns; |
| 240 | k = (k ^ lastAns) % n + 1; |
| 241 | lastAns = kthMax(u, x, k); |
| 242 | if (lastAns == 0) { |
| 243 | io.writelnInt(-1); |
| 244 | } else { |
| 245 | io.writelnInt(lastAns); |
| 246 | } |
| 247 | } |
| 248 | io.flush(); |
| 249 | } |
| 250 | |
| 251 | // 读写工具类 |
| 252 | static class FastIO { |
nothing calls this directly
no test coverage detected