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

Method main

src/class201/Code07_Network1.java:239–292  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

237 }
238
239 public static void main(String[] args) throws Exception {
240 FastReader in = new FastReader(System.in);
241 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
242 n = in.nextInt();
243 m = in.nextInt();
244 C = in.nextInt();
245 q = in.nextInt();
246 for (int i = 1, v; i <= n; i++) {
247 v = in.nextInt();
248 for (int c = 0; c < C; c++) {
249 int cur = node(c, i);
250 arr[cur] = v;
251 maxv[cur] = v;
252 }
253 }
254 for (int i = 1, x, y, c; i <= m; i++) {
255 x = in.nextInt();
256 y = in.nextInt();
257 c = in.nextInt();
258 connect(c, x, y);
259 }
260 for (int i = 1, op, x, y, c; i <= q; i++) {
261 op = in.nextInt();
262 if (op == 0) {
263 x = in.nextInt();
264 y = in.nextInt();
265 updateNode(x, y);
266 } else if (op == 1) {
267 x = in.nextInt();
268 y = in.nextInt();
269 c = in.nextInt();
270 int ans = updateEdge(x, y, c);
271 if (ans == 1) {
272 out.println("Error 1.");
273 }
274 if (ans == 2) {
275 out.println("Error 2.");
276 }
277 if (ans == 3) {
278 out.println("No such edge.");
279 }
280 if (ans == 4) {
281 out.println("Success.");
282 }
283 } else {
284 c = in.nextInt();
285 x = in.nextInt();
286 y = in.nextInt();
287 out.println(query(c, x, y));
288 }
289 }
290 out.flush();
291 out.close();
292 }
293
294 // 读写工具类
295 static class FastReader {

Callers

nothing calls this directly

Calls 9

nextIntMethod · 0.95
nodeMethod · 0.95
connectMethod · 0.95
updateNodeMethod · 0.95
updateEdgeMethod · 0.95
queryMethod · 0.95
printlnMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected