rt,实在看不出哪里错了
#include <bits/stdc++.h>
inline double min(double x,double y) {
return x<y ? x : y;
}
inline double max(double x,double y) {
return x>y ? x : y;
}
inline long long read() {
long long x;char ch;bool f;
for(f=0;!isdigit(ch=getchar());f=ch=='-');
for(x=ch-48;isdigit(ch=getchar());x=x*10+ch-48);
return f?-x:x;
}
inline void print(long long x,char las) {
if(!x) {
putchar(48),putchar(las);
return ;
}
if(x<0) putchar('-'),x=-x;
int ls[20],k=0;
while(x) ls[++k]=x%10,x/=10;
while(k) putchar(ls[k--]+48);
putchar(las);
return ;
}
struct vector {
double x,y;
inline bool operator<(const vector &ls) const {
return y*ls.x<x*ls.y;
}
inline double len() {
return sqrt(x*x+y*y);
}
inline double operator*(const vector &ls) const {
return x*ls.y-y*ls.x;
}
inline double operator^(const vector &ls) const {
return x*ls.x+y*ls.y;
}
inline vector operator-(const vector &ls) const {
return {x-ls.x,y-ls.y};
}
inline vector operator+(const vector &ls) const {
return {x+ls.x,y+ls.y};
}
inline bool operator==(const vector &ls) const {
return (x==ls.x && y==ls.y) ? true : false;
}
};
struct node {
vector x,y;
inline double len() {
return (x-y).len();
}
};
int t=read();
inline bool done() {
node l[3];
for(int i=0;i<3;i++) l[i].x.x=read(),l[i].x.y=read(),l[i].y.x=read(),l[i].y.y=read();
//侧边判断
for(int i=0,p=0;i<3;i++) {
for(int j=0;j<i;j++) {
if(l[i].x==l[j].x || l[i].x==l[j].y || l[i].y==l[j].x || l[i].y==l[j].y) {
std::swap(l[1],l[j]);
std::swap(l[0],l[i]);
p=1;break;
}
}
if(p) break;
}
//对齐重点
if(l[0].x==l[1].y) std::swap(l[1].x,l[1].y);
if(l[1].x==l[0].y) std::swap(l[0].x,l[0].y);
if(l[1].y==l[0].y) std::swap(l[0].x,l[0].y),std::swap(l[1].x,l[1].y);
double a=(l[2].x-l[0].x).len(),b=(l[2].x-l[0].y).len(),c=l[0].len(),d=l[1].len();
//夹角判断
if(((l[1].y-l[1].x)^(l[0].y-l[0].x))<0.0 || (l[1].y-l[1].x)*(l[0].y-l[0].x)==0.0) return false;
//比值判断
if(a+b-c) std::swap(l[2].x,l[2].y);
a=(l[2].x-l[0].x).len(),b=(l[2].x-l[0].y).len();
if(a+b-c) return false;
if(min(a,b)/max(a,b)<0.25) return false;
a=(l[2].y-l[1].x).len(),b=(l[2].y-l[1].y).len();
if(a+b-d) return false;
if(min(a,b)/max(a,b)<0.25) return false;
return true;
}
int main() {
while(t--) puts(done() ? "YES" : "NO");
return 0;
}