Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef struct{long long x,y;}cord;
- typedef struct{cord l,u;}rect;
- inline long long area(rect r){return max(r.u.x - r.l.x + 1, 1LL) * max(r.u.y - r.l.y + 1, 1LL);}
- inline long long calcW(rect r){
- if(area(r) % 2 != 0 && r.l.x % 2 == 1)
- return area(r)/2 + 1;
- return area(r)/2;
- }
- inline long long calcB(rect r){return area(r) - calcW(r);}
- inline bool inRect(rect r, cord c){
- return (c.x - r.l.x) >= 0 && (c.y - r.l.y) >= 0 && (r.u.x - c.x) >= 0 && (r.u.y - c.y) >= 0;
- }
- int main(){
- long long t,n,m;
- scanf("%lld",&t);
- while(t--){
- scanf("%lld%lld",&n,&m);
- rect white,black;
- scanf("%lld%lld%lld%lld", &white.l.x, &white.l.y, &white.u.x, &white.u.y);
- scanf("%lld%lld%lld%lld", &black.l.x, &black.l.y, &black.u.x, &black.u.y);
- long long addW=0,addB=0;
- addW = calcB(white);
- addB = calcW(black);
- printf("%d %d\n",inRect(white,black.l),inRect(white,black.u));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement