Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <algorithm>
- using namespace std;
- int nx,ny;
- double w;
- double x[1010];
- double y[1010];
- double checkGrass(double p[], int pn) {
- double last=0.0;
- sort(p,p+pn);
- for (int i=0; i<pn; i++)
- if (last>=p[i]-w/2.0)
- last=p[i]+w/2.0;
- else
- break;
- return last;
- }
- int main() {
- while (1) {
- scanf("%d %d %lf", &nx,&ny,&w);
- if (!nx && !ny && !w)
- break;
- for (int i=0; i<nx; i++)
- scanf("%lf", &x[i]);
- for (int i=0; i<ny; i++)
- scanf("%lf", &y[i]);
- if (checkGrass(x,nx)>=75.0 &&
- checkGrass(y,ny)>=100.0)
- printf("YES\n");
- else
- printf("NO\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement