# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56493 | 2018-07-11T13:24:52 Z | red1108 | None (KOI17_cat) | C++17 | 542 ms | 263168 KB |
#include <stdio.h> #include <algorithm> #include <vector> typedef long long ll; using namespace std; vector<int> graph[300010]; int visit[300010], comp[300010],link[300010]; int n, m,vcnt; int dfs(int now, int from) { int cmp=1,ret,child=0; ret=visit[now]=++vcnt; for(auto i:graph[now]) { if(i==from) continue; if(!visit[i]) { int df; df=dfs(i,now); if(df>=visit[now]) cmp++; ret=min(ret,df); child++; } else ret=min(ret,visit[i]); } if(from==0) cmp=child; comp[now]=cmp; return ret; } int main() { scanf("%d %d", &n, &m); for(int i=1;i<=m;i++) { int a, b; scanf("%d %d", &a, &b); graph[a].push_back(b); graph[b].push_back(a); link[a]++,link[b]++; } dfs(1,0); ll ans=0; for(int i=1;i<=n;i++) { if(m-link[i]==n-comp[i]-1) ans+=i; } printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 7288 KB | Output is correct |
2 | Correct | 9 ms | 7400 KB | Output is correct |
3 | Correct | 7 ms | 7512 KB | Output is correct |
4 | Correct | 7 ms | 7512 KB | Output is correct |
5 | Correct | 11 ms | 7924 KB | Output is correct |
6 | Correct | 13 ms | 7968 KB | Output is correct |
7 | Correct | 11 ms | 8248 KB | Output is correct |
8 | Correct | 13 ms | 8264 KB | Output is correct |
9 | Correct | 12 ms | 8492 KB | Output is correct |
10 | Correct | 11 ms | 8492 KB | Output is correct |
11 | Correct | 11 ms | 8588 KB | Output is correct |
12 | Correct | 12 ms | 8640 KB | Output is correct |
13 | Correct | 11 ms | 8648 KB | Output is correct |
14 | Correct | 11 ms | 8648 KB | Output is correct |
15 | Correct | 9 ms | 8648 KB | Output is correct |
16 | Correct | 8 ms | 8648 KB | Output is correct |
17 | Correct | 8 ms | 8648 KB | Output is correct |
18 | Correct | 9 ms | 8648 KB | Output is correct |
19 | Correct | 8 ms | 8648 KB | Output is correct |
20 | Correct | 12 ms | 8840 KB | Output is correct |
21 | Correct | 17 ms | 8900 KB | Output is correct |
22 | Correct | 13 ms | 8972 KB | Output is correct |
23 | Correct | 12 ms | 8972 KB | Output is correct |
24 | Correct | 13 ms | 8972 KB | Output is correct |
25 | Correct | 10 ms | 8972 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 408 ms | 25740 KB | Output is correct |
2 | Correct | 368 ms | 29652 KB | Output is correct |
3 | Correct | 378 ms | 33384 KB | Output is correct |
4 | Correct | 345 ms | 37384 KB | Output is correct |
5 | Correct | 411 ms | 41212 KB | Output is correct |
6 | Correct | 384 ms | 45240 KB | Output is correct |
7 | Correct | 353 ms | 49112 KB | Output is correct |
8 | Correct | 412 ms | 52992 KB | Output is correct |
9 | Correct | 389 ms | 57016 KB | Output is correct |
10 | Correct | 361 ms | 60912 KB | Output is correct |
11 | Correct | 414 ms | 65312 KB | Output is correct |
12 | Correct | 385 ms | 69152 KB | Output is correct |
13 | Correct | 371 ms | 73000 KB | Output is correct |
14 | Correct | 460 ms | 76968 KB | Output is correct |
15 | Correct | 394 ms | 80816 KB | Output is correct |
16 | Correct | 343 ms | 89384 KB | Output is correct |
17 | Correct | 363 ms | 94232 KB | Output is correct |
18 | Correct | 392 ms | 96088 KB | Output is correct |
19 | Correct | 411 ms | 101012 KB | Output is correct |
20 | Correct | 495 ms | 103752 KB | Output is correct |
21 | Correct | 428 ms | 106172 KB | Output is correct |
22 | Correct | 333 ms | 118856 KB | Output is correct |
23 | Correct | 359 ms | 125528 KB | Output is correct |
24 | Correct | 411 ms | 125528 KB | Output is correct |
25 | Correct | 378 ms | 132212 KB | Output is correct |
26 | Correct | 161 ms | 146320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 172 ms | 150104 KB | Output is correct |
2 | Correct | 189 ms | 154040 KB | Output is correct |
3 | Correct | 182 ms | 157912 KB | Output is correct |
4 | Correct | 173 ms | 161800 KB | Output is correct |
5 | Correct | 216 ms | 165720 KB | Output is correct |
6 | Correct | 161 ms | 169592 KB | Output is correct |
7 | Correct | 209 ms | 173624 KB | Output is correct |
8 | Correct | 150 ms | 177384 KB | Output is correct |
9 | Correct | 174 ms | 181452 KB | Output is correct |
10 | Correct | 188 ms | 181452 KB | Output is correct |
11 | Correct | 200 ms | 183480 KB | Output is correct |
12 | Correct | 194 ms | 187180 KB | Output is correct |
13 | Correct | 175 ms | 190988 KB | Output is correct |
14 | Correct | 177 ms | 195044 KB | Output is correct |
15 | Correct | 226 ms | 195044 KB | Output is correct |
16 | Correct | 231 ms | 196432 KB | Output is correct |
17 | Correct | 242 ms | 200344 KB | Output is correct |
18 | Correct | 181 ms | 204080 KB | Output is correct |
19 | Correct | 192 ms | 207864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 7288 KB | Output is correct |
2 | Correct | 9 ms | 7400 KB | Output is correct |
3 | Correct | 7 ms | 7512 KB | Output is correct |
4 | Correct | 7 ms | 7512 KB | Output is correct |
5 | Correct | 11 ms | 7924 KB | Output is correct |
6 | Correct | 13 ms | 7968 KB | Output is correct |
7 | Correct | 11 ms | 8248 KB | Output is correct |
8 | Correct | 13 ms | 8264 KB | Output is correct |
9 | Correct | 12 ms | 8492 KB | Output is correct |
10 | Correct | 11 ms | 8492 KB | Output is correct |
11 | Correct | 11 ms | 8588 KB | Output is correct |
12 | Correct | 12 ms | 8640 KB | Output is correct |
13 | Correct | 11 ms | 8648 KB | Output is correct |
14 | Correct | 11 ms | 8648 KB | Output is correct |
15 | Correct | 9 ms | 8648 KB | Output is correct |
16 | Correct | 8 ms | 8648 KB | Output is correct |
17 | Correct | 8 ms | 8648 KB | Output is correct |
18 | Correct | 9 ms | 8648 KB | Output is correct |
19 | Correct | 8 ms | 8648 KB | Output is correct |
20 | Correct | 12 ms | 8840 KB | Output is correct |
21 | Correct | 17 ms | 8900 KB | Output is correct |
22 | Correct | 13 ms | 8972 KB | Output is correct |
23 | Correct | 12 ms | 8972 KB | Output is correct |
24 | Correct | 13 ms | 8972 KB | Output is correct |
25 | Correct | 10 ms | 8972 KB | Output is correct |
26 | Correct | 408 ms | 25740 KB | Output is correct |
27 | Correct | 368 ms | 29652 KB | Output is correct |
28 | Correct | 378 ms | 33384 KB | Output is correct |
29 | Correct | 345 ms | 37384 KB | Output is correct |
30 | Correct | 411 ms | 41212 KB | Output is correct |
31 | Correct | 384 ms | 45240 KB | Output is correct |
32 | Correct | 353 ms | 49112 KB | Output is correct |
33 | Correct | 412 ms | 52992 KB | Output is correct |
34 | Correct | 389 ms | 57016 KB | Output is correct |
35 | Correct | 361 ms | 60912 KB | Output is correct |
36 | Correct | 414 ms | 65312 KB | Output is correct |
37 | Correct | 385 ms | 69152 KB | Output is correct |
38 | Correct | 371 ms | 73000 KB | Output is correct |
39 | Correct | 460 ms | 76968 KB | Output is correct |
40 | Correct | 394 ms | 80816 KB | Output is correct |
41 | Correct | 343 ms | 89384 KB | Output is correct |
42 | Correct | 363 ms | 94232 KB | Output is correct |
43 | Correct | 392 ms | 96088 KB | Output is correct |
44 | Correct | 411 ms | 101012 KB | Output is correct |
45 | Correct | 495 ms | 103752 KB | Output is correct |
46 | Correct | 428 ms | 106172 KB | Output is correct |
47 | Correct | 333 ms | 118856 KB | Output is correct |
48 | Correct | 359 ms | 125528 KB | Output is correct |
49 | Correct | 411 ms | 125528 KB | Output is correct |
50 | Correct | 378 ms | 132212 KB | Output is correct |
51 | Correct | 161 ms | 146320 KB | Output is correct |
52 | Correct | 172 ms | 150104 KB | Output is correct |
53 | Correct | 189 ms | 154040 KB | Output is correct |
54 | Correct | 182 ms | 157912 KB | Output is correct |
55 | Correct | 173 ms | 161800 KB | Output is correct |
56 | Correct | 216 ms | 165720 KB | Output is correct |
57 | Correct | 161 ms | 169592 KB | Output is correct |
58 | Correct | 209 ms | 173624 KB | Output is correct |
59 | Correct | 150 ms | 177384 KB | Output is correct |
60 | Correct | 174 ms | 181452 KB | Output is correct |
61 | Correct | 188 ms | 181452 KB | Output is correct |
62 | Correct | 200 ms | 183480 KB | Output is correct |
63 | Correct | 194 ms | 187180 KB | Output is correct |
64 | Correct | 175 ms | 190988 KB | Output is correct |
65 | Correct | 177 ms | 195044 KB | Output is correct |
66 | Correct | 226 ms | 195044 KB | Output is correct |
67 | Correct | 231 ms | 196432 KB | Output is correct |
68 | Correct | 242 ms | 200344 KB | Output is correct |
69 | Correct | 181 ms | 204080 KB | Output is correct |
70 | Correct | 192 ms | 207864 KB | Output is correct |
71 | Correct | 475 ms | 221752 KB | Output is correct |
72 | Correct | 439 ms | 223788 KB | Output is correct |
73 | Correct | 509 ms | 226940 KB | Output is correct |
74 | Correct | 469 ms | 232796 KB | Output is correct |
75 | Correct | 411 ms | 233524 KB | Output is correct |
76 | Correct | 380 ms | 237044 KB | Output is correct |
77 | Correct | 373 ms | 237044 KB | Output is correct |
78 | Correct | 394 ms | 239708 KB | Output is correct |
79 | Correct | 473 ms | 252700 KB | Output is correct |
80 | Correct | 542 ms | 252700 KB | Output is correct |
81 | Correct | 463 ms | 253280 KB | Output is correct |
82 | Runtime error | 494 ms | 263168 KB | Memory limit exceeded 263168 {'time-wall': '0.569', 'max-rss': '42200', 'csw-forced': '113', 'cg-mem': '263168', 'time': '0.494', 'csw-voluntary': '4'} 262144 |
83 | Halted | 0 ms | 0 KB | - |