QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#473085 | #6412. Classical Geometry Problem | UESTC_DebugSimulator | WA | 21ms | 3940kb | C++17 | 2.2kb | 2024-07-11 21:45:55 | 2024-07-11 21:45:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
double a,b,c;
double a1,b1,c1;
double a2,b2,c2;
double a3,b3,c3;
double x;
struct arr{
int x,y,z;
double d;
}ans[7];
double dist3(double x,double y,double z,double xx,double yy,double zz)
{
return sqrt((x-xx)*(x-xx)+(y-yy)*(y-yy)+(z-zz)*(z-zz));
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ans[4].x=ans[4].y=ans[4].z=255;
ans[4].d=500;
int T;
cin>>T;
while(T--)
{
cin>>a>>b>>c;
for(int i=1;i<=3;i++)
{
ans[i].x=ans[i].y=ans[i].z=0;
ans[i].d=0;
}
if(a==0&&b==0&&c==0)
{
cout<<"0\n";
continue;
}
x=max({a,b,c});
x=255/x;
a1=a*x;b1=b*x;c1=c*x;
ans[1].x=ans[1].y=ans[1].z=0;
ans[1].d=dist3(a,b,c,a1,b1,c1);
if(a1==255)
{
x=max(b1,c1);
x=255/x;
b2=b1*x;c2=c1*x;
ans[2].x=255;ans[2].y=ans[2].z=0;
ans[2].d=dist3(0,b1,c1,0,b2,c2);
if(b2==255)
{
x=c2;
x=255/x;
c3=c2*x;
ans[3].x=255;ans[3].y=255;ans[3].z=0;
ans[3].d=dist3(0,0,c2,0,0,c3);
}
else
{
x=b2;
x=255/x;
b3=b2*x;
ans[3].x=255;ans[3].y=0;ans[3].z=255;
ans[3].d=dist3(0,b2,0,0,b3,0);
}
}
else if(b1==255)
{
x=max(a1,c1);
x=255/x;
a2=a1*x;c2=c1*x;
ans[2].x=0;ans[2].y=255;ans[2].z=0;
ans[2].d=dist3(a1,0,c1,a2,0,c2);
if(a2==255)
{
x=c2;
x=255/x;
c3=c2*x;
ans[3].x=255;ans[3].y=255;ans[3].z=0;
ans[3].d=dist3(0,0,c2,0,0,c3);
}
else
{
x=a2;
x=255/x;
a3=a2*x;
ans[3].x=0;ans[3].y=255;ans[3].z=255;
ans[3].d=dist3(a2,0,0,a3,0,0);
}
}
else
{
x=max(a1,b1);
x=255/x;
a2=a1*x;b2=b1*x;
ans[2].x=0;ans[2].y=0;ans[2].z=255;
ans[2].d=dist3(a1,b1,0,a2,b2,0);
if(a2==255)
{
x=b2;
x=255/x;
b3=b2*x;
ans[3].x=255;ans[3].y=0;ans[3].z=255;
ans[3].d=dist3(0,b2,0,0,b3,0);
}
else
{
x=a2;
x=255/x;
a3=a2*x;
ans[3].x=0;ans[3].y=255;ans[3].z=255;
ans[3].d=dist3(a2,0,0,a3,0,0);
}
}
cout<<"4\n";
for(int i=4;i>=1;i--)
{
cout<<setprecision(10)<<ans[i].x<<" "<<ans[i].y<<" "<<ans[i].z<<" "<<ans[i].d<<"\n";
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3936kb
input:
3 105 255 175 174 174 174 0 0 0
output:
4 255 255 255 500 0 255 255 102 0 255 0 93.29523032 0 0 0 0 4 255 255 255 500 255 255 0 0 255 0 0 0 0 0 0 140.2961154 0
result:
ok ok (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 21ms
memory: 3940kb
input:
10000 250 128 13 1 245 2 88 183 138 179 69 194 153 246 33 255 119 192 233 30 108 26 208 33 53 162 189 225 130 10 202 137 121 152 198 25 49 165 180 228 56 30 74 18 14 6 115 31 168 242 206 90 238 139 44 103 60 16 21 190 229 209 68 41 171 181 39 74 73 181 96 18 234 95 70 75 174 84 101 16 44 202 249 80 ...
output:
4 255 255 255 500 255 255 0 229.1015625 255 0 0 125.0801491 0 0 0 5.623273068 4 255 255 255 500 0 255 255 127.5 0 255 0 282.7713311 0 0 0 10.00041648 4 255 255 255 500 0 255 255 92.39130435 0 255 0 74.36912353 0 0 0 96.59557262 4 255 255 255 500 0 255 255 5.684341886e-14 0 0 255 21.13062725 0 0 0 85...
result:
wrong answer too far from the target: (191.555537, 191.555537, 203.478253) instead of (179, 69, 194) (test case 4)