#include "parks.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define trav(a,v) for(auto a:v)
typedef long long int lld;
#define INF 1000000000000000LL
vector<pair<int,int> >V;
map<pair<int,int>,int> m;
std::vector<int> u, v, X, Y;
void add(int a, int b){
if(m.find({a+1,b+1})!=m.end() && m.find({a+1,b-1})!=m.end()){
u.push_back(m[{a+1,b+1}]);
v.push_back(m[{a+1,b-1}]);
X.push_back(a);
Y.push_back(b);
}
if(m.find({a+1,b+1})!=m.end() && m.find({a-1,b+1})!=m.end()){
u.push_back(m[{a+1,b+1}]);
v.push_back(m[{a-1,b+1}]);
X.push_back(a);
Y.push_back(b);
}
if(m.find({a-1,b-1})!=m.end() && m.find({a+1,b-1})!=m.end()){
u.push_back(m[{a-1,b-1}]);
v.push_back(m[{a+1,b-1}]);
X.push_back(a);
Y.push_back(b);
}
if(m.find({a-1,b-1})!=m.end() && m.find({a-1,b+1})!=m.end()){
u.push_back(m[{a-1,b-1}]);
v.push_back(m[{a-1,b+1}]);
X.push_back(a);
Y.push_back(b);
}
}
int construct_roads(std::vector<int> x, std::vector<int> y) {
rep(i,0,x.size()){
m[{x[i],y[i]}]=i;
}
add(1,3);
add(3,1);
add(5,3);
add(3,5);
//cout<<u.size()<<endl;
if(u.size()==0 && x.size()>0)return 0;
build(u, v, X, Y);
return 1;
}
Compilation message
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:5:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
5 | #define rep(i,a,b) for(int i=a;i<b;i++)
......
41 | rep(i,0,x.size()){
| ~~~~~~~~~~~~
parks.cpp:41:2: note: in expansion of macro 'rep'
41 | rep(i,0,x.size()){
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Solution announced impossible, but it is possible. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Solution announced impossible, but it is possible. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Solution announced impossible, but it is possible. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Solution announced impossible, but it is possible. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Solution announced impossible, but it is possible. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Solution announced impossible, but it is possible. |
2 |
Halted |
0 ms |
0 KB |
- |