Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class whiteSheet {
- public static void main(String[] args) throws IOException {
- BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
- String s[]=br.readLine().split(" ");
- int x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;
- x1=Integer.parseInt(s[0]);
- y1=Integer.parseInt(s[1]);
- x2=Integer.parseInt(s[2]);
- y2=Integer.parseInt(s[3]);
- String st[]=br.readLine().split(" ");
- x3=Integer.parseInt(st[0]);
- y3=Integer.parseInt(st[1]);
- x4=Integer.parseInt(st[2]);
- y4=Integer.parseInt(st[3]);
- String str[]=br.readLine().split(" ");
- x5=Integer.parseInt(str[0]);
- y5=Integer.parseInt(str[1]);
- x6=Integer.parseInt(str[2]);
- y6=Integer.parseInt(str[3]);
- boolean fl=false;
- if(x3<=x1 && y3<=y1 && x4>=x2 && y4>=y2)//white sheet is completely inside first black sheet
- fl=true;
- if(fl==false && x5<=x1 && y5<=y1 && x6>=x2 && y6>=y2)//white sheet is completely inside second black sheet
- fl=true;
- if(fl==false && x3<=x1 && y3<=y1 && x4>x1 && x4<x2 && y4>=y2)//case 1
- x1=x4;
- if(fl==false && x4>=x2 && y4>=y2 && x3>x1 && x3<x2 && y3<=y2)//case 2
- x2=x3;
- if(fl==false && x3<=x1 && x4>=x2 && y4>=y2 && y3>y1 && y3<y2)//case 3
- y2=y3;
- if(fl==false && x3<=x1 && x4>=x1 && y3<=y1 && y4>y1 && y4<y2)//case 4
- y1=y4;
- if(fl==false && x5<=x1 && y5<=y1 && x6>=x2 && y6>=y2)//checking if second black sheet covers the remaining part
- fl=true;
- if(fl==true)
- System.out.print("NO");
- else
- System.out.print("YES");
- }
- }
Add Comment
Please, Sign In to add comment