#include <bits/stdc++.h>
#define DIM 2010
using namespace std;
struct tree{
int x,y,r;
};
tree v[DIM];
int dist_up, dist_down, dist_left, dist_right;
int n,m,w,h,i,x,poz,r;
int verif (int x, int y, int r){
if (x == y)
return 1;
if (x > y)
swap (x,y);
if (x == 1){
if (y == 2){
if (dist_down >= r || (dist_left >= r && dist_right >= r && dist_up >= r))
return 1;
return 0;
}
if (y == 3){
if ( (dist_left >= r && dist_up >= r) || (dist_right >= r && dist_down >= r))
return 1;
return 0;
}
if (y == 4){
if (dist_left >= r || (dist_down >= r && dist_right >= r && dist_up >= r))
return 1;
return 0;
}
}
if (x == 2){
if (y == 3){
if (dist_right >= r || (dist_down >= r && dist_left >= r && dist_up >= r))
return 1;
return 0;
}
if (y == 4){
if ( (dist_down >= r && dist_left >= r) || (dist_up >= r && dist_right >= r))
return 1;
return 0;
}
}
if (dist_up >= r || (dist_down >= r && dist_right >= r && dist_left >= r))
return 1;
return 0;
}
int main (){
// ifstream cin ("date.in");
// ofstream cout ("date.out");
cin>>n>>m>>w>>h;
for (i=1;i<=n;i++)
cin>>v[i].x>>v[i].y>>v[i].r;
if (n == 1){
int x = v[1].x, y = v[1].y, r = v[1].r;
dist_up = h - y - r;
dist_down = y - r;
dist_left = x - r;
dist_right = w - x - r;
for (i=1;i<=m;i++){
cin>>r>>poz;
if (verif(poz,1,r))
cout<<1;
if (verif(poz,2,r))
cout<<2;
if (verif(poz,3,r))
cout<<3;
if (verif(poz,4,r))
cout<<4;
cout<<"\n";
}
return 0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |