#include "parks.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
int construct_roads(vector<int> x, vector<int> y) {
int n = x.size();
int N = 2e5;
vector<map<int, int>> id(N + 1);
for (int i = 0; i < n; ++i) {
id[x[i]][y[i]] = i;
}
int cnt = 0;
vector<int> u, v, a, b;
for (int i = 0; i < n; ++i) {
if (id[x[i]].count(y[i] + 2)) {
u.push_back(i);
v.push_back(id[x[i]][y[i] + 2]);
a.push_back(x[i] + 1);
b.push_back(y[i] + 1);
++cnt;
}
}
if (cnt == n - 1) {
build(u, v, a, b);
return 1;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9820 KB |
Output is correct |
3 |
Correct |
4 ms |
9820 KB |
Output is correct |
4 |
Correct |
4 ms |
9820 KB |
Output is correct |
5 |
Correct |
4 ms |
9820 KB |
Output is correct |
6 |
Correct |
5 ms |
9820 KB |
Output is correct |
7 |
Correct |
4 ms |
9628 KB |
Output is correct |
8 |
Correct |
5 ms |
9820 KB |
Output is correct |
9 |
Correct |
117 ms |
20708 KB |
Output is correct |
10 |
Correct |
13 ms |
11096 KB |
Output is correct |
11 |
Correct |
33 ms |
15820 KB |
Output is correct |
12 |
Correct |
11 ms |
11356 KB |
Output is correct |
13 |
Correct |
23 ms |
13448 KB |
Output is correct |
14 |
Correct |
4 ms |
9816 KB |
Output is correct |
15 |
Correct |
5 ms |
9952 KB |
Output is correct |
16 |
Correct |
97 ms |
20928 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9820 KB |
Output is correct |
3 |
Correct |
4 ms |
9820 KB |
Output is correct |
4 |
Correct |
4 ms |
9820 KB |
Output is correct |
5 |
Correct |
4 ms |
9820 KB |
Output is correct |
6 |
Correct |
5 ms |
9820 KB |
Output is correct |
7 |
Correct |
4 ms |
9628 KB |
Output is correct |
8 |
Correct |
5 ms |
9820 KB |
Output is correct |
9 |
Correct |
117 ms |
20708 KB |
Output is correct |
10 |
Correct |
13 ms |
11096 KB |
Output is correct |
11 |
Correct |
33 ms |
15820 KB |
Output is correct |
12 |
Correct |
11 ms |
11356 KB |
Output is correct |
13 |
Correct |
23 ms |
13448 KB |
Output is correct |
14 |
Correct |
4 ms |
9816 KB |
Output is correct |
15 |
Correct |
5 ms |
9952 KB |
Output is correct |
16 |
Correct |
97 ms |
20928 KB |
Output is correct |
17 |
Incorrect |
6 ms |
9816 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9820 KB |
Output is correct |
3 |
Correct |
4 ms |
9820 KB |
Output is correct |
4 |
Correct |
4 ms |
9820 KB |
Output is correct |
5 |
Correct |
4 ms |
9820 KB |
Output is correct |
6 |
Correct |
5 ms |
9820 KB |
Output is correct |
7 |
Correct |
4 ms |
9628 KB |
Output is correct |
8 |
Correct |
5 ms |
9820 KB |
Output is correct |
9 |
Correct |
117 ms |
20708 KB |
Output is correct |
10 |
Correct |
13 ms |
11096 KB |
Output is correct |
11 |
Correct |
33 ms |
15820 KB |
Output is correct |
12 |
Correct |
11 ms |
11356 KB |
Output is correct |
13 |
Correct |
23 ms |
13448 KB |
Output is correct |
14 |
Correct |
4 ms |
9816 KB |
Output is correct |
15 |
Correct |
5 ms |
9952 KB |
Output is correct |
16 |
Correct |
97 ms |
20928 KB |
Output is correct |
17 |
Incorrect |
6 ms |
9816 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9820 KB |
Output is correct |
3 |
Correct |
4 ms |
9820 KB |
Output is correct |
4 |
Correct |
4 ms |
9820 KB |
Output is correct |
5 |
Correct |
4 ms |
9820 KB |
Output is correct |
6 |
Correct |
5 ms |
9820 KB |
Output is correct |
7 |
Correct |
4 ms |
9628 KB |
Output is correct |
8 |
Correct |
5 ms |
9820 KB |
Output is correct |
9 |
Correct |
117 ms |
20708 KB |
Output is correct |
10 |
Correct |
13 ms |
11096 KB |
Output is correct |
11 |
Correct |
33 ms |
15820 KB |
Output is correct |
12 |
Correct |
11 ms |
11356 KB |
Output is correct |
13 |
Correct |
23 ms |
13448 KB |
Output is correct |
14 |
Correct |
4 ms |
9816 KB |
Output is correct |
15 |
Correct |
5 ms |
9952 KB |
Output is correct |
16 |
Correct |
97 ms |
20928 KB |
Output is correct |
17 |
Incorrect |
4 ms |
9820 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9820 KB |
Output is correct |
3 |
Correct |
4 ms |
9820 KB |
Output is correct |
4 |
Correct |
4 ms |
9820 KB |
Output is correct |
5 |
Correct |
4 ms |
9820 KB |
Output is correct |
6 |
Correct |
5 ms |
9820 KB |
Output is correct |
7 |
Correct |
4 ms |
9628 KB |
Output is correct |
8 |
Correct |
5 ms |
9820 KB |
Output is correct |
9 |
Correct |
117 ms |
20708 KB |
Output is correct |
10 |
Correct |
13 ms |
11096 KB |
Output is correct |
11 |
Correct |
33 ms |
15820 KB |
Output is correct |
12 |
Correct |
11 ms |
11356 KB |
Output is correct |
13 |
Correct |
23 ms |
13448 KB |
Output is correct |
14 |
Correct |
4 ms |
9816 KB |
Output is correct |
15 |
Correct |
5 ms |
9952 KB |
Output is correct |
16 |
Correct |
97 ms |
20928 KB |
Output is correct |
17 |
Incorrect |
158 ms |
23932 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9820 KB |
Output is correct |
3 |
Correct |
4 ms |
9820 KB |
Output is correct |
4 |
Correct |
4 ms |
9820 KB |
Output is correct |
5 |
Correct |
4 ms |
9820 KB |
Output is correct |
6 |
Correct |
5 ms |
9820 KB |
Output is correct |
7 |
Correct |
4 ms |
9628 KB |
Output is correct |
8 |
Correct |
5 ms |
9820 KB |
Output is correct |
9 |
Correct |
117 ms |
20708 KB |
Output is correct |
10 |
Correct |
13 ms |
11096 KB |
Output is correct |
11 |
Correct |
33 ms |
15820 KB |
Output is correct |
12 |
Correct |
11 ms |
11356 KB |
Output is correct |
13 |
Correct |
23 ms |
13448 KB |
Output is correct |
14 |
Correct |
4 ms |
9816 KB |
Output is correct |
15 |
Correct |
5 ms |
9952 KB |
Output is correct |
16 |
Correct |
97 ms |
20928 KB |
Output is correct |
17 |
Incorrect |
6 ms |
9816 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |