Advertisement
TimxAG

opencup

Nov 19th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,i,x1,x2,x3,x4,y1,y2,y3,y4;
  6. cin >> n;
  7. for (i=0; i<n; i++)
  8. {
  9. cin >> x1 >> y1 >> x2 >> y2;
  10. cin >> x3 >> y3 >> x4 >> y4;
  11. y1=-y1;y2=-y2;y3=-y3;y4=-y4;
  12. if ((x3>=x1) && (x4<=x2) && (y3<=y1) && (y4>=y2)) cout << "B in A\n";
  13. else if ((x1>=x3) && (x2<=x4) && (y1<=y3) && (y2>=y4)) cout << "A in B\n";
  14. else
  15. if ((( (x1 >= x3) && (x1 <=x4) ) || ( (x3 >= x1) && (x3 <= x2) )) && (( (y1 <= y3) && (y1 >=y4) ) || ( (y3 <= y1) && (y3 >= y2)) ) )
  16. cout << "Intersect\n";
  17. else
  18. cout << "Separate\n";
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement