#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
int construct_roads(std::vector<int> x, std::vector<int> y) {
vector<pair<pair<int,int>, int>> p;
int n = x.size();
for(int i = 0;i<n;i++) {
p.push_back({{y[i], x[i]}, i});
}
sort(p.begin(), p.end());
vector<int> u, v, a, b;
for(int i = 1;i<n;i++) {
if(p[i].first.first == p[i-1].first.first+2) {
u.push_back(p[i-1].second);
v.push_back(p[i].second);
a.push_back(p[i].first.second+1);
b.push_back(p[i].first.first-1);
}
else {
return 0;
}
}
build(u, v, a, b);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
41 ms |
9032 KB |
Output is correct |
10 |
Correct |
3 ms |
1312 KB |
Output is correct |
11 |
Correct |
16 ms |
4940 KB |
Output is correct |
12 |
Correct |
5 ms |
1648 KB |
Output is correct |
13 |
Correct |
6 ms |
2520 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
464 KB |
Output is correct |
16 |
Correct |
37 ms |
8952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
41 ms |
9032 KB |
Output is correct |
10 |
Correct |
3 ms |
1312 KB |
Output is correct |
11 |
Correct |
16 ms |
4940 KB |
Output is correct |
12 |
Correct |
5 ms |
1648 KB |
Output is correct |
13 |
Correct |
6 ms |
2520 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
464 KB |
Output is correct |
16 |
Correct |
37 ms |
8952 KB |
Output is correct |
17 |
Incorrect |
0 ms |
348 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
41 ms |
9032 KB |
Output is correct |
10 |
Correct |
3 ms |
1312 KB |
Output is correct |
11 |
Correct |
16 ms |
4940 KB |
Output is correct |
12 |
Correct |
5 ms |
1648 KB |
Output is correct |
13 |
Correct |
6 ms |
2520 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
464 KB |
Output is correct |
16 |
Correct |
37 ms |
8952 KB |
Output is correct |
17 |
Incorrect |
0 ms |
348 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
41 ms |
9032 KB |
Output is correct |
10 |
Correct |
3 ms |
1312 KB |
Output is correct |
11 |
Correct |
16 ms |
4940 KB |
Output is correct |
12 |
Correct |
5 ms |
1648 KB |
Output is correct |
13 |
Correct |
6 ms |
2520 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
464 KB |
Output is correct |
16 |
Correct |
37 ms |
8952 KB |
Output is correct |
17 |
Incorrect |
0 ms |
348 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
41 ms |
9032 KB |
Output is correct |
10 |
Correct |
3 ms |
1312 KB |
Output is correct |
11 |
Correct |
16 ms |
4940 KB |
Output is correct |
12 |
Correct |
5 ms |
1648 KB |
Output is correct |
13 |
Correct |
6 ms |
2520 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
464 KB |
Output is correct |
16 |
Correct |
37 ms |
8952 KB |
Output is correct |
17 |
Incorrect |
45 ms |
8908 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
41 ms |
9032 KB |
Output is correct |
10 |
Correct |
3 ms |
1312 KB |
Output is correct |
11 |
Correct |
16 ms |
4940 KB |
Output is correct |
12 |
Correct |
5 ms |
1648 KB |
Output is correct |
13 |
Correct |
6 ms |
2520 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
464 KB |
Output is correct |
16 |
Correct |
37 ms |
8952 KB |
Output is correct |
17 |
Incorrect |
0 ms |
348 KB |
Solution announced impossible, but it is possible. |
18 |
Halted |
0 ms |
0 KB |
- |