-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercisingwalk.cpp
More file actions
83 lines (79 loc) · 1.63 KB
/
exercisingwalk.cpp
File metadata and controls
83 lines (79 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include<bits/stdc++.h>
using namespace std;
// https://codeforces.com/contest/1332/problem/A
#define ll long long
#define pb push_back
#define setbits(x) __builtin_popcountll(x)
#define MOD 1000000007
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
int a,b,c,d;
int x,y,x1,y1,x2,y2;
cin>>a>>b>>c>>d;
cin>>x>>y>>x1>>y1>>x2>>y2;
int mx=x2-x1,my=y2-y1,cx=x-a+b,cy=y-c+d;
if(mx==0 and my==0)
{
if(a>0 or b>0 or c>0 or d>0)
{
cout<<"NO"<<endl;
}
else
{
cout<<"YES"<<endl;
}
}
else if(mx==0)
{
if(a>0 or b>0)
{
cout<<"NO"<<endl;
}
else if(cy>y2 or cy<y1)
{
cout<<"NO"<<endl;
}
else
{
cout<<"YES"<<endl;
}
}
else if(my==0)
{
if(c>0 or d>0)
{
cout<<"NO"<<endl;
}
else if(cx>x2 or cx<x1)
{
cout<<"NO"<<endl;
}
else
{
cout<<"YES"<<endl;
}
}
else
{
if(cy>y2 or cy<y1)
{
cout<<"NO"<<endl;
}
else if(cx>x2 or cx<x1)
{
cout<<"NO"<<endl;
}
else
{
cout<<"YES"<<endl;
}
}
}
return 0;
}