meghana180799

Untitled

Sep 27th, 2019
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. public class whiteSheet {
  5. public static void main(String[] args) throws IOException {
  6. BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  7. String s[]=br.readLine().split(" ");
  8. int x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;
  9. x1=Integer.parseInt(s[0]);
  10. y1=Integer.parseInt(s[1]);
  11. x2=Integer.parseInt(s[2]);
  12. y2=Integer.parseInt(s[3]);
  13. String st[]=br.readLine().split(" ");
  14. x3=Integer.parseInt(st[0]);
  15. y3=Integer.parseInt(st[1]);
  16. x4=Integer.parseInt(st[2]);
  17. y4=Integer.parseInt(st[3]);
  18. String str[]=br.readLine().split(" ");
  19. x5=Integer.parseInt(str[0]);
  20. y5=Integer.parseInt(str[1]);
  21. x6=Integer.parseInt(str[2]);
  22. y6=Integer.parseInt(str[3]);
  23. boolean fl=false;
  24. if(x3<=x1 && y3<=y1 && x4>=x2 && y4>=y2)//white sheet is completely inside first black sheet
  25. fl=true;
  26. if(fl==false && x5<=x1 && y5<=y1 && x6>=x2 && y6>=y2)//white sheet is completely inside second black sheet
  27. fl=true;
  28. if(fl==false && x3<=x1 && y3<=y1 && x4>x1 && x4<x2 && y4>=y2)//case 1
  29. x1=x4;
  30. if(fl==false && x4>=x2 && y4>=y2 && x3>x1 && x3<x2 && y3<=y2)//case 2
  31. x2=x3;
  32. if(fl==false && x3<=x1 && x4>=x2 && y4>=y2 && y3>y1 && y3<y2)//case 3
  33. y2=y3;
  34. if(fl==false && x3<=x1 && x4>=x1 && y3<=y1 && y4>y1 && y4<y2)//case 4
  35. y1=y4;
  36. if(fl==false && x5<=x1 && y5<=y1 && x6>=x2 && y6>=y2)//checking if second black sheet covers the remaining part
  37. fl=true;
  38. if(fl==true)
  39. System.out.print("NO");
  40. else
  41. System.out.print("YES");
  42. }
  43. }
Add Comment
Please, Sign In to add comment