# Untitled

unknown
plain_text
a year ago
1.5 kB
5
Indexable
Never
```#include<bits/stdc++.h>
#define ll long long int
using namespace std;

int main(){
int T; cin >> T;
while(T--){
pair<int, int> H; pair<int, int> A; pair<int, int> B; pair<int, int> O;
cin >> H.first >> H.second;
cin >> A.first >> A.second;
cin >> B. first >> B.second;
O.first = 0; O.second = 0;

float distance[10] = {};
// home to a
distance[0] = sqrt(pow(H.first - A.first,2) + pow(H.second - A.second, 2));

// a to b
distance[1] = sqrt(pow(A.first - B.first,2) + pow(A.second - B.second, 2));

//home to b
distance[2] = sqrt(pow(B.first - H.first,2) + pow(H.second - B.second, 2));

//home to origin
distance[3] = sqrt(pow(H.first - O.first,2) + pow(H.second - O.second, 2));

//a to origin
distance[4] = sqrt(pow(A.first - O.first,2) + pow(A.second - O.second, 2));

//b to origin
distance[5] = sqrt(pow(B.first - O.first,2) + pow(B.second - O.second, 2));

double ans[3] = {1e5, 1e5, 1e5};
// if O is within A or B
bool C1 = (distance[4] <= distance[1]/2) || (distance[5] <= distance[1]/2);

// if H is within A or B
bool C2 = (distance[0] <= distance[1]/2) || (distance[2] <= distance[1]/2);

if(C1 && C2){
ans[0] = distance[1]/2;
}

ans[1] = max(distance[0] , distance[4]);
ans[2] = max(distance[2] , distance[5]);

double min = 1e5;
for(int i = 0; i < 3; i++){
if(ans[i] < min){
min = ans[i];
}

}
cout << min << endl;

}
return 0;
}```