QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#442720 | #6763. Triangle Pendant | positive1 | WA | 1ms | 3948kb | C++14 | 1.7kb | 2024-06-15 13:21:14 | 2024-06-15 13:21:16 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr double eps=1e-9;
int r[3][3],s[3];
double mid[3],ans[3];
template<typename T>T sqr(T x)
{
return x*x;
}
bool sing(int a)
{
int b=(a+1)%3,c=(a+2)%3;
double bm=r[b][c]/2.0,bm2=sqr(bm),am2=(sqr(r[a][b])+sqr(r[a][c]))/2.0-bm2,am=sqrt(am2);
mid[a]=am*2/3;
for(int i:{b,c})
{
int ab=r[a][i],ab2=sqr(ab);
double al=(am2+ab2-bm2)/2/am;
if(sqr(s[i])<al*s[a]+ab2+sqr(s[a])-eps) return false;
ans[i]=-s[a]-al;
}
ans[a]=-s[a];
return true;
}
double hei(double h,double x,double y)
{
return -(sqr(h)+sqr(y)-sqr(x))/2/h;
}
bool twin(int a,int b)
{
auto dis=[](double ad,double bd,double ab,double ac,double bc)
{
double cosdab=(sqr(ad)+sqr(ab)-sqr(bd))/2/ab/ad;
double coscab=(sqr(ac)+sqr(ab)-sqr(bc))/2/ab/ac;
double cosdac=cosdab*coscab-sqrt((1-sqr(cosdab))*(1-sqr(coscab)));
return sqrt(sqr(ad)+sqr(ac)-2*ad*ac*cosdac);
};
int c=3-a-b;
double cd=dis(s[a],s[b],r[a][b],r[a][c],r[b][c]);
if(s[c]<cd-eps) return false;
double dm=dis(s[a],s[b],r[a][b],mid[a],mid[b]);
ans[a]=hei(dm,mid[a],s[a]);
ans[b]=hei(dm,mid[b],s[b]);
ans[c]=hei(dm,mid[c],cd);
return true;
}
bool pyr()
{
double dg=sqrt(3*(sqr(s[0])+sqr(s[1])+sqr(s[2]))-sqr(r[0][1])-sqr(r[1][2])-sqr(r[0][2]))/3;
for(int i=0;i<3;i++) ans[i]=hei(dg,mid[i],s[i]);
return true;
}
int main()
{
ios::sync_with_stdio(false),cin.tie(0);
int T;
cin>>T;
cout<<fixed<<setprecision(5);
while(T--)
{
cin>>s[0]>>s[1]>>s[2]>>r[1][2]>>r[0][2]>>r[0][1];
r[1][0]=r[0][1];
r[2][1]=r[1][2];
r[2][0]=r[0][2];
sing(0)||sing(1)||sing(2)||twin(0,1)||twin(1,2)||twin(0,2)||pyr();
cout<<ans[0]<<' '<<ans[1]<<' '<<ans[2]<<'\n';
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3948kb
input:
2 1 1 1 1 1 1 2 3 3 1 1 1
output:
-0.81650 -0.81650 -0.81650 -2.00000 -2.86603 -2.86603
result:
ok 6 numbers
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3848kb
input:
1000 21 2 14 12 13 4 29 19 13 15 10 17 29 24 15 29 24 23 29 17 30 18 9 25 27 24 30 16 4 15 28 13 17 12 21 16 16 22 10 22 15 8 15 23 24 23 27 13 26 3 27 15 16 17 5 8 20 17 6 12 24 14 13 15 19 13 27 22 18 18 23 30 22 18 14 11 29 28 7 13 22 22 17 11 19 9 16 22 20 17 21 14 20 6 29 25 20 10 19 9 27 27 17...
output:
-2.93586 -2.00000 -13.35235 -22.14648 -16.07620 -12.24183 -28.02743 -18.31858 -8.24336 -27.26612 -13.15932 -26.88253 -26.53493 -22.06663 -29.61608 -26.96780 -12.55767 -14.18672 -15.77860 -20.86268 -5.15586 -10.93310 -21.91558 -17.77740 -18.04415 -3.00000 -15.74074 -4.13677 1.28738 -9.68713 -23.51828...
result:
wrong answer 100th numbers differ - expected: '-12.56729', found: '-13.43535', error = '0.06907'