QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#549483 | #7521. Find the Gap | paramec1um# | RE | 0ms | 0kb | C++20 | 1.3kb | 2024-09-06 16:20:12 | 2024-09-06 16:20:12 |
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn=60;
#define IN inline
struct Point{
double x,y,z;
IN Point operator+(const Point &t)const{return {x+t.x,y+t.y,z+t.z};}
IN Point operator-(const Point &t)const{return {x-t.x,y-t.y,z-t.z};}
IN Point operator*(const Point &t)const{return {y*t.z-z*t.y,z*t.x-x*t.z,x*t.y-y*t.x};}
IN Point operator*(const double &t)const{return{x*t,y*t,z*t};}
IN double operator^(const Point &t)const{return x*t.x+y*t.y+z*t.z;}
}a[maxn];
IN double sqr(double x){return x*x;}
IN double dis(Point a){return sqr(a.x)+sqr(a.y)+sqr(a.z);}
double ans=1e18;
void solve(){
int n;
cin>>n;
for(int i=1;i<=n;++i){
cin>>a[i].x>>a[i].y>>a[i].z;
}
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
Point A=a[i]-a[j];
for(int k=1;k<=n;++k){
for(int k1=1;k1<=n;++k1){
Point B=a[k]-a[k1];
Point no=A*B;
double d=dis(no);
if(d==0)continue;
double dd=0;
double h1=no^a[1],h2=no^a[2];
for(int m=1;m<=n;++m){
h1=min(h1,no^a[m]);
h2=max(h2,no^a[m]);
}
ans=min(ans,fabs(h1-h2)/sqrt(d));
}
}
}
}
cout<<fixed<<setprecision(15);
if(ans==1e18)ans=0;
cout<<ans<<'\n';
}
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
fstream in("in.txt",ios::in);cin.rdbuf(in.rdbuf());
int T=1;
while(T--)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
8 1 1 1 1 1 2 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1 2 2 2