-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB_Good_Start.cpp
More file actions
52 lines (44 loc) · 746 Bytes
/
Copy pathB_Good_Start.cpp
File metadata and controls
52 lines (44 loc) · 746 Bytes
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
#include <bits/stdc++.h>
using namespace std;
# define ll long long
int solve()
{
ll w,h,a,b;
cin >> w >> h >> a >> b;
ll x1,y1,x2,y2;
cin >> x1 >> y1 >> x2 >> y2;
if(x1 == x2){
if(abs(y1 - y2)%b==0){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
return 0;
}
if(y1 == y2){
if(abs(x1 - x2)%a==0){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
return 0;
}
if((x1 - x2)%a==0 || (y1-y2)%b==0){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
return 0;
}
int main()
{
int tc;
cin>>tc;
while(tc--)
{
solve();
}
}