-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA.cpp
More file actions
34 lines (33 loc) · 741 Bytes
/
A.cpp
File metadata and controls
34 lines (33 loc) · 741 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
#include<bits/stdc++.h>
using namespace std;
int flag(int xa , int ya , int xb ,int yb ,int xf, int yf){
if(ya==yb){
if(yf==ya){
if(xf>=xa and xf<=xb)return 2;
}
else
return 0;
}
else if(xa==xb){
if(xf==xa){
if(yf>=ya and yf<=yb){
return 2;
}
else
return 0;
}
}
return 0;
}
signed main() {
cout.tie();
int t;
cin>>t;
while(t--) {
int xa,ya,xb,yb,xf,yf;
cin>>xa>>ya>>xb>>yb>>xf>>yf;
int ans = 0 ;
ans=max(flag(xa,ya,xb,yb,xf,yf),flag(xb,yb,xa,ya,xf,yf));
cout<<ans+abs(xa-xb)+abs(ya-yb)<<endl;
}
}