(String[] args)
| 216 | } |
| 217 | |
| 218 | public static void main(String[] args) { |
| 219 | FastIO io = new FastIO(System.in, System.out); |
| 220 | t = io.nextInt(); |
| 221 | for (int test = 1; test <= t; test++) { |
| 222 | n = io.nextInt(); |
| 223 | m = io.nextInt(); |
| 224 | clear(); |
| 225 | for (int i = 1; i <= m; i++) { |
| 226 | edge[i][0] = io.nextInt(); |
| 227 | edge[i][1] = io.nextInt(); |
| 228 | edge[i][2] = io.nextInt(); |
| 229 | edge[i][3] = io.nextInt(); |
| 230 | } |
| 231 | dijkstra(); |
| 232 | kruskalRebuild(); |
| 233 | dfs2(cntu, 0); |
| 234 | q = io.nextInt(); |
| 235 | k = io.nextInt(); |
| 236 | s = io.nextInt(); |
| 237 | for (int i = 1, x, y, lastAns = 0; i <= q; i++) { |
| 238 | x = (io.nextInt() + k * lastAns - 1) % n + 1; |
| 239 | y = (io.nextInt() + k * lastAns) % (s + 1); |
| 240 | lastAns = query(x, y); |
| 241 | io.writelnInt(lastAns); |
| 242 | } |
| 243 | } |
| 244 | io.flush(); |
| 245 | } |
| 246 | |
| 247 | // 读写工具类 |
| 248 | static class FastIO { |
nothing calls this directly
no test coverage detected