Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,i,x1,x2,x3,x4,y1,y2,y3,y4;
- cin >> n;
- for (i=0; i<n; i++)
- {
- cin >> x1 >> y1 >> x2 >> y2;
- cin >> x3 >> y3 >> x4 >> y4;
- y1=-y1;y2=-y2;y3=-y3;y4=-y4;
- if ((x3>=x1) && (x4<=x2) && (y3<=y1) && (y4>=y2)) cout << "B in A\n";
- else if ((x1>=x3) && (x2<=x4) && (y1<=y3) && (y2>=y4)) cout << "A in B\n";
- else
- if ((( (x1 >= x3) && (x1 <=x4) ) || ( (x3 >= x1) && (x3 <= x2) )) && (( (y1 <= y3) && (y1 >=y4) ) || ( (y3 <= y1) && (y3 >= y2)) ) )
- cout << "Intersect\n";
- else
- cout << "Separate\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement