MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / main

Method main

src/class164/Code04_Journey1.java:218–245  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 8

nextIntMethod · 0.95
clearMethod · 0.95
dijkstraMethod · 0.95
kruskalRebuildMethod · 0.95
dfs2Method · 0.95
queryMethod · 0.95
writelnIntMethod · 0.95
flushMethod · 0.95

Tested by

no test coverage detected