#include #include #include #include #include using namespace std; typedef long long LL; LL cross(pair < LL , LL > A , pair < LL , LL > B){ return A.first * B.second - A.second * B.first; } pair < LL , LL > dif(pair < LL , LL > A, pair < LL , LL > B) { return {B.first-A.first , B.second - A.second}; } pair < LL , LL > gg; bool cmp(pair < LL , LL > &A , pair < LL , LL > &B) { return cross(dif(gg,A) , dif(gg,B))>0; } int main() { int Q , N , i ; cin>>Q; for(;Q;--Q){ cin>>N; vector < pair < LL , LL > > A(N); vector < LL > X(N) , Y(N); for(i=0;i>A[i].first>>A[i].second; X[i] = A[i].first; Y[i] = A[i].second; } sort(X.begin(),X.end()); sort(Y.begin(),Y.end()); int x_min = X[0] , x_max = *X.rbegin() ; int y_min = Y[0] , y_max = *Y.rbegin() ; bool flag = 1; for(i=0;i