#include <vector>
using namespace std;
void build(std::vector<int> u, std::vector<int> v, std::vector<int> a, std::vector<int> b);
int construct_roads(std::vector<int> x, std::vector<int> y)
{
bool pos=1;
int n=x.size();
vector<int> u,v,a,b;
vector<vector<int>> cp;
for(int i=0;i<n;i++)
cp.push_back({y[i],x[i],i});
for(int i=0;(i+1)<n;i++)
{
// go from y[i] to y[i+1]
if(cp[i+1][0]-cp[i][0] != 2)
return 0;
u.push_back(cp[i][2]);
v.push_back(cp[i+1][2]);
a.push_back(cp[i][1]-1);
b.push_back(cp[i][0]-1);
}
build(u,v,a,b);
return 1;
}
Compilation message
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:6:7: warning: unused variable 'pos' [-Wunused-variable]
6 | bool pos=1;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Tree (a[0], b[0]) = (1, 1) is not adjacent to edge between u[0]=0 @(2, 2) and v[0]=1 @(2, 4) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Tree (a[0], b[0]) = (1, 1) is not adjacent to edge between u[0]=0 @(2, 2) and v[0]=1 @(2, 4) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Tree (a[0], b[0]) = (1, 1) is not adjacent to edge between u[0]=0 @(2, 2) and v[0]=1 @(2, 4) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Tree (a[0], b[0]) = (1, 1) is not adjacent to edge between u[0]=0 @(2, 2) and v[0]=1 @(2, 4) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Tree (a[0], b[0]) = (1, 1) is not adjacent to edge between u[0]=0 @(2, 2) and v[0]=1 @(2, 4) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Tree (a[0], b[0]) = (1, 1) is not adjacent to edge between u[0]=0 @(2, 2) and v[0]=1 @(2, 4) |
3 |
Halted |
0 ms |
0 KB |
- |