QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#472250 | #6412. Classical Geometry Problem | UESTC_xxx# | WA | 17ms | 3908kb | C++20 | 2.0kb | 2024-07-11 15:17:13 | 2024-07-11 15:17:14 |
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{
int a,b,c;
}x;
double L(node a){
return sqrt(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;
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);
d=1.0*x.a*l/v.a;
x.a=0,x.b-=1.0*v.b*d/l,x.c-=1.0*v.c*d/l;
}
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);
d=1.0*x.b*l/v.b;
x.b=0,x.c-=1.0*v.c*d/l;
}
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);
d=1.0*x.c*l/v.c;
}
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].b,ans[i].c),swap(ans[i].a,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].b,ans[i].c),swap(ans[i].a,ans[i].b);
}
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);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3908kb
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: 3888kb
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 243.000000000000 255 255 0 121.121235766566 255 255 255 14.683872523535 3 0 255 0 243.000000000000 0 255 255 1.000937312598 255 255 255 1.411981404758 3 0 255 0 98.000000000000 0 255 255 89.203448737644 255 255 255 113.949582887387 3 0 0 255 51.000000000000 255 0 255 192.093727122985 255 2...
result:
wrong answer too far from the target: (249.014907, 127.816770, 12.995067) instead of (250, 128, 13) (test case 1)