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

Method main

src/class194/Code08_Tourists1.java:221–260  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

219 }
220
221 public static void main(String[] args) throws Exception {
222 FastReader in = new FastReader(System.in);
223 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
224 n = in.nextInt();
225 m = in.nextInt();
226 q = in.nextInt();
227 cntn = n;
228 for (int i = 1; i <= n; i++) {
229 arr[i] = in.nextInt();
230 }
231 for (int i = 1, u, v; i <= m; i++) {
232 u = in.nextInt();
233 v = in.nextInt();
234 addEdge1(u, v);
235 addEdge1(v, u);
236 }
237 tarjan(1);
238 dfs1(1, 0);
239 dfs2(1, 1);
240 build(1, cnti, 1);
241 for (int i = 1; i <= q; i++) {
242 char op = in.nextChar();
243 int x = in.nextInt();
244 int y = in.nextInt();
245 if (op == 'C') {
246 int father = fa[x];
247 if (father > 0) {
248 delNum(father, arr[x]);
249 addNum(father, y);
250 update(nid[father], getMin(father), 1, cnti, 1);
251 }
252 arr[x] = y;
253 update(nid[x], y, 1, cnti, 1);
254 } else {
255 out.println(pathMin(x, y));
256 }
257 }
258 out.flush();
259 out.close();
260 }
261
262 // 读写工具类
263 static class FastReader {

Callers

nothing calls this directly

Calls 15

nextIntMethod · 0.95
addEdge1Method · 0.95
tarjanMethod · 0.95
dfs1Method · 0.95
dfs2Method · 0.95
buildMethod · 0.95
nextCharMethod · 0.95
delNumMethod · 0.95
addNumMethod · 0.95
updateMethod · 0.95
getMinMethod · 0.95
pathMinMethod · 0.95

Tested by

no test coverage detected