# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
117159 | 2019-06-15T05:31:19 Z | onjo0127 | None (JOI16_ho_t3) | C++11 | 178 ms | 17536 KB |
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; struct edge { int u, v, t; } E[200009]; vector<pii> adj[100009]; int dep[100009], D[100009], dif[200009]; int main() { int N, M, Q; scanf("%d%d%d",&N,&M,&Q); for(int i=1; i<=M; i++) { scanf("%d%d", &E[i].u, &E[i].v); E[i].t = Q+1; } for(int i=1; i<=Q; i++) { int foo; scanf("%d",&foo); E[foo].t = i; } for(int i=1; i<=M; i++) { int x = E[i].u, y = E[i].v, c = E[i].t; adj[x].push_back({y, c}); adj[y].push_back({x, c}); } queue<int> que; que.push(1); dep[1] = 1; D[1] = Q+1; int d = 1; while(que.size()) { int sz = que.size(); while(sz--) { int now = que.front(); que.pop(); ++dif[D[now]]; for(auto& it: adj[now]) { if(!dep[it.first]) { dep[it.first] = d + 1; D[it.first] = min(D[now], it.second); que.push(it.first); } else if(dep[it.first] == d + 1) { D[it.first] = max(D[it.first], min(D[now], it.second)); } } } ++d; } for(int i=1, s=0; i<=Q; i++) { s += dif[i]; printf("%d\n",s); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2816 KB | Output is correct |
2 | Correct | 5 ms | 2688 KB | Output is correct |
3 | Correct | 5 ms | 2944 KB | Output is correct |
4 | Correct | 4 ms | 2688 KB | Output is correct |
5 | Correct | 5 ms | 2816 KB | Output is correct |
6 | Correct | 5 ms | 2688 KB | Output is correct |
7 | Correct | 4 ms | 2688 KB | Output is correct |
8 | Correct | 5 ms | 2688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2816 KB | Output is correct |
2 | Correct | 5 ms | 2688 KB | Output is correct |
3 | Correct | 5 ms | 2944 KB | Output is correct |
4 | Correct | 4 ms | 2688 KB | Output is correct |
5 | Correct | 5 ms | 2816 KB | Output is correct |
6 | Correct | 5 ms | 2688 KB | Output is correct |
7 | Correct | 4 ms | 2688 KB | Output is correct |
8 | Correct | 5 ms | 2688 KB | Output is correct |
9 | Correct | 146 ms | 14560 KB | Output is correct |
10 | Correct | 128 ms | 14528 KB | Output is correct |
11 | Correct | 122 ms | 14132 KB | Output is correct |
12 | Correct | 124 ms | 14200 KB | Output is correct |
13 | Correct | 117 ms | 14304 KB | Output is correct |
14 | Correct | 109 ms | 14200 KB | Output is correct |
15 | Correct | 76 ms | 10104 KB | Output is correct |
16 | Correct | 56 ms | 8952 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 132 ms | 14456 KB | Output is correct |
2 | Correct | 102 ms | 14456 KB | Output is correct |
3 | Correct | 83 ms | 11888 KB | Output is correct |
4 | Correct | 97 ms | 14200 KB | Output is correct |
5 | Correct | 96 ms | 14200 KB | Output is correct |
6 | Correct | 107 ms | 14220 KB | Output is correct |
7 | Correct | 53 ms | 8996 KB | Output is correct |
8 | Correct | 56 ms | 8916 KB | Output is correct |
9 | Correct | 39 ms | 8688 KB | Output is correct |
10 | Correct | 36 ms | 8656 KB | Output is correct |
11 | Correct | 135 ms | 14456 KB | Output is correct |
12 | Correct | 120 ms | 14112 KB | Output is correct |
13 | Correct | 123 ms | 13816 KB | Output is correct |
14 | Correct | 135 ms | 14660 KB | Output is correct |
15 | Correct | 159 ms | 14072 KB | Output is correct |
16 | Correct | 134 ms | 13892 KB | Output is correct |
17 | Correct | 135 ms | 13788 KB | Output is correct |
18 | Correct | 89 ms | 10032 KB | Output is correct |
19 | Correct | 164 ms | 16760 KB | Output is correct |
20 | Correct | 141 ms | 13908 KB | Output is correct |
21 | Correct | 68 ms | 9464 KB | Output is correct |
22 | Correct | 65 ms | 9464 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2816 KB | Output is correct |
2 | Correct | 5 ms | 2688 KB | Output is correct |
3 | Correct | 5 ms | 2944 KB | Output is correct |
4 | Correct | 4 ms | 2688 KB | Output is correct |
5 | Correct | 5 ms | 2816 KB | Output is correct |
6 | Correct | 5 ms | 2688 KB | Output is correct |
7 | Correct | 4 ms | 2688 KB | Output is correct |
8 | Correct | 5 ms | 2688 KB | Output is correct |
9 | Correct | 146 ms | 14560 KB | Output is correct |
10 | Correct | 128 ms | 14528 KB | Output is correct |
11 | Correct | 122 ms | 14132 KB | Output is correct |
12 | Correct | 124 ms | 14200 KB | Output is correct |
13 | Correct | 117 ms | 14304 KB | Output is correct |
14 | Correct | 109 ms | 14200 KB | Output is correct |
15 | Correct | 76 ms | 10104 KB | Output is correct |
16 | Correct | 56 ms | 8952 KB | Output is correct |
17 | Correct | 132 ms | 14456 KB | Output is correct |
18 | Correct | 102 ms | 14456 KB | Output is correct |
19 | Correct | 83 ms | 11888 KB | Output is correct |
20 | Correct | 97 ms | 14200 KB | Output is correct |
21 | Correct | 96 ms | 14200 KB | Output is correct |
22 | Correct | 107 ms | 14220 KB | Output is correct |
23 | Correct | 53 ms | 8996 KB | Output is correct |
24 | Correct | 56 ms | 8916 KB | Output is correct |
25 | Correct | 39 ms | 8688 KB | Output is correct |
26 | Correct | 36 ms | 8656 KB | Output is correct |
27 | Correct | 135 ms | 14456 KB | Output is correct |
28 | Correct | 120 ms | 14112 KB | Output is correct |
29 | Correct | 123 ms | 13816 KB | Output is correct |
30 | Correct | 135 ms | 14660 KB | Output is correct |
31 | Correct | 159 ms | 14072 KB | Output is correct |
32 | Correct | 134 ms | 13892 KB | Output is correct |
33 | Correct | 135 ms | 13788 KB | Output is correct |
34 | Correct | 89 ms | 10032 KB | Output is correct |
35 | Correct | 164 ms | 16760 KB | Output is correct |
36 | Correct | 141 ms | 13908 KB | Output is correct |
37 | Correct | 68 ms | 9464 KB | Output is correct |
38 | Correct | 65 ms | 9464 KB | Output is correct |
39 | Correct | 178 ms | 17192 KB | Output is correct |
40 | Correct | 168 ms | 17528 KB | Output is correct |
41 | Correct | 115 ms | 13416 KB | Output is correct |
42 | Correct | 153 ms | 17016 KB | Output is correct |
43 | Correct | 157 ms | 17536 KB | Output is correct |
44 | Correct | 158 ms | 17476 KB | Output is correct |
45 | Correct | 176 ms | 17360 KB | Output is correct |
46 | Correct | 82 ms | 10868 KB | Output is correct |
47 | Correct | 85 ms | 10620 KB | Output is correct |
48 | Correct | 91 ms | 10460 KB | Output is correct |
49 | Correct | 63 ms | 9960 KB | Output is correct |
50 | Correct | 62 ms | 9940 KB | Output is correct |
51 | Correct | 64 ms | 10472 KB | Output is correct |
52 | Correct | 70 ms | 10732 KB | Output is correct |
53 | Correct | 59 ms | 9920 KB | Output is correct |
54 | Correct | 57 ms | 10092 KB | Output is correct |