QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#472328 | #6412. Classical Geometry Problem | UESTC_xxx# | WA | 17ms | 3896kb | C++20 | 2.1kb | 2024-07-11 15:41:58 | 2024-07-11 15:41:58 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#include<cmath>
#include<stack>
#include<vector>
#include<map>
#define ll long long
#define lowbit(x) x&(-x)
using namespace std;
int tt,a,b,c;
double d;
struct N{
int a,b,c;
double d;
}ans[5];
struct node{
double a,b,c;
}x;
int L(node a){
return a.a*a.a+a.b*a.b+a.c*a.c;
}
node mis(node a,node b){
node c;
c.a=a.a-b.a,c.b=a.b-b.b,c.c=a.c-b.c;
return c;
}
node mul(node a,double f){
a.a*=f,a.b*=f,a.c*=f;
return a;
}
void sol(){
x.a=a,x.b=b,x.c=c;
node p,v;
double l,d,q;
p.a=p.b=p.c=255;
v=mis(p,x);
if(x.a==255) d=9999;
else{
v=mul(v,255/(255-x.a));
l=L(v);
q=1.0*x.a/v.a;
d=l*q*q;
d=sqrt(d);
x.a=0,x.b-=1.0*v.b*q,x.c-=1.0*v.c*q;
}
if(d<0) d=0;
ans[3].a=p.a,ans[3].b=p.b,ans[3].c=p.c,ans[3].d=d;
p.a=0,p.b=p.c=255;
v=mis(p,x);
if(x.b==255) d=9999;
else{
v=mul(v,255/(255-x.b));
l=L(v);
q=1.0*x.b/v.b;
d=l*q*q;
d=sqrt(d);
x.a=0,x.b=0,x.c-=1.0*v.c*q;
}
if(d<0) d=0;
ans[2].a=p.a,ans[2].b=p.b,ans[2].c=p.c,ans[2].d=d;
p.a=p.b=0,p.c=255;
v=mis(p,x);
if(x.c==255) d=9999;
else{
v=mul(v,255/(255-x.c));
l=L(v);
q=1.0*x.c/v.c;
d=l*q*q;
d=sqrt(d);
}
if(d<0) d=0;
ans[1].a=p.a,ans[1].b=p.b,ans[1].c=p.c,ans[1].d=d;
}
int main(){
scanf("%d",&tt);
while(tt--){
scanf("%d%d%d",&a,&b,&c);
if(a<=b&&b<=c) sol();
else if(a<=c&&c<=b){
swap(b,c);
sol();
for(int i=1;i<=3;++i) swap(ans[i].b,ans[i].c);
}
else if(b<=a&&a<=c){
swap(a,b);
sol();
for(int i=1;i<=3;++i) swap(ans[i].a,ans[i].b);
}
else if(b<=c&&c<=a){
swap(b,c),swap(a,c);
sol();
for(int i=1;i<=3;++i) swap(ans[i].a,ans[i].c),swap(ans[i].b,ans[i].c);
}
else if(c<=a&&a<=b){
swap(b,c),swap(a,b);
sol();
for(int i=1;i<=3;++i) swap(ans[i].a,ans[i].b),swap(ans[i].b,ans[i].c);
}
else if(c<=b&&b<=a){
swap(a,c);
sol();
for(int i=1;i<=3;++i) swap(ans[i].a,ans[i].c);
}
printf("3\n");
for(int i=1;i<=3;++i) printf("%d %d %d %.12lf\n",ans[i].a,ans[i].b,ans[i].c,ans[i].d);
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3856kb
input:
3 105 255 175 174 174 174 0 0 0
output:
3 0 255 0 9999.000000000000 0 255 255 119.000000000000 255 255 255 119.000000000000 3 0 0 255 0.000000000000 0 255 255 0.000000000000 255 255 255 301.376840516985 3 0 0 255 0.000000000000 0 255 255 0.000000000000 255 255 255 0.000000000000
result:
ok ok (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 17ms
memory: 3896kb
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:
3 255 0 0 244.960629921260 255 255 0 121.270827921083 255 255 255 14.683857493718 3 0 255 0 244.920948616601 0 255 255 1.004716387300 255 255 255 1.411977108205 3 0 255 0 98.076923076923 0 255 255 89.645038476063 255 255 255 113.949261390640 3 0 0 255 50.328947368421 255 0 255 193.374436466981 255 2...
result:
wrong answer too far from the target: (249.999972, 127.999288, 12.999971) instead of (250, 128, 13) (test case 1)