-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1904A.cpp
62 lines (44 loc) · 897 Bytes
/
1904A.cpp
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
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
void solve() {
int a, b;
cin >> a >> b;
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
set<pair<int, int>> s1, s2;
s1.insert({x1+a, y1-b});
s1.insert({x1-a, y1-b});
s1.insert({x1+a, y1+b});
s1.insert({x1-a, y1+b});
s1.insert({x1+b, y1-a});
s1.insert({x1+b, y1+a});
s1.insert({x1-b, y1+a});
s1.insert({x1-b, y1-a});
s2.insert({x2+a, y2-b});
s2.insert({x2-a, y2-b});
s2.insert({x2+a, y2+b});
s2.insert({x2-a, y2+b});
s2.insert({x2+b, y2-a});
s2.insert({x2+b, y2+a});
s2.insert({x2-b, y2+a});
s2.insert({x2-b, y2-a});
int ans = 0;
for(auto x: s1){
if(s2.find(x) != s2.end()){
ans++;
}
}
cout << ans << endl;
return;
}
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
int t = 1;
cin >> t;
while(t--){
solve();
}
return 0;
}