QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#408150 | #6412. Classical Geometry Problem | grass8cow# | WA | 18ms | 3912kb | C++17 | 1.4kb | 2024-05-09 19:03:51 | 2024-05-09 19:03:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define db double
const int O=255;
const db eps=1e-9;
bool ap(db x,db y){return abs(x-y)<eps;}
db p2(db x){return x*x;}
int ans;
int X[12],Y[12],Z[12];
db D[12];
void xp(int x,int y,int z,db d){
ans++,X[ans]=x,Y[ans]=y,Z[ans]=z,D[ans]=d;
}
void sol(){
ans=0;
db x,y,z;
scanf("%lf%lf%lf",&x,&y,&z);
x/=O,y/=O,z/=O;
if(ap(x,1)&&ap(y,1)&&ap(z,1))xp(1,1,1,1000);
else{
db D=sqrt(p2(1-x)+p2(1-y)+p2(1-z));
db te=1e9+7;
if(!ap(x,1))te=min(te,x/(1-x));if(!ap(y,1))te=min(te,y/(1-y));if(!ap(z,1))te=min(te,z/(1-z));
xp(1,1,1,D*te);
x-=te*(1-x),y-=te*(1-y),z-=te*(1-z);
int w=-1;
if(ap(x,0))w=0;
else if(ap(y,0))w=1,swap(x,y);
else w=2,swap(x,z);
if(ap(y,1)&&ap(z,1))xp(0,1,1,1000);
else{
D=sqrt(p2(1-y)+p2(1-z)),te=1e9+7;
if(!ap(y,1))te=min(te,y/(1-y));if(!ap(z,1))te=min(te,z/(1-z));
xp(0,1,1,D*te),y-=te*(1-y),z-=te*(1-z);
if(ap(y,0))xp(0,0,1,z);
else xp(0,1,0,y);
}
for(int i=2;i<=ans;i++){
if(w==1)swap(X[i],Y[i]);
if(w==2)swap(X[i],Z[i]);
}
}
printf("%d\n",ans);
for(int i=ans;i;i--)printf("%d %d %d %.10lf\n",X[i]*O,Y[i]*O,Z[i]*O,D[i]*O);
}
int main(){
int T;scanf("%d",&T);while(T--)sol();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3816kb
input:
3 105 255 175 174 174 174 0 0 0
output:
3 0 255 0 255.0000000000 0 255 255 119.0000000000 255 255 255 119.0000000000 3 0 0 255 0.0000000000 0 255 255 0.0000000000 255 255 255 301.3768405170 3 0 0 255 0.0000000000 0 255 255 0.0000000000 255 255 255 0.0000000000
result:
ok ok (3 test cases)
Test #2:
score: 0
Accepted
time: 12ms
memory: 3912kb
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.9606299213 255 255 0 121.2715624817 255 255 255 14.6838725235 3 0 255 0 244.9209486166 0 255 255 1.0047209173 255 255 255 1.4119814048 3 0 255 0 98.0769230769 0 255 255 89.6454644917 255 255 255 113.9495828874 3 0 0 255 50.3289473684 255 0 255 193.3746533137 255 255 255 77.8970427654 3...
result:
ok ok (10000 test cases)
Test #3:
score: 0
Accepted
time: 18ms
memory: 3848kb
input:
10000 90 173 87 39 251 59 39 43 150 106 29 130 52 55 180 236 225 70 171 15 48 92 133 240 182 226 10 126 139 105 196 7 204 32 131 193 27 96 218 67 29 33 159 9 251 130 111 243 226 69 39 198 131 80 108 169 147 45 36 170 76 138 251 55 235 186 224 165 48 51 133 173 225 14 226 234 70 139 178 92 174 138 24...
output:
3 0 255 0 128.2727272727 255 255 0 5.0848916386 255 255 255 129.1251629886 3 0 255 0 249.7959183673 0 255 255 23.6160275320 255 255 255 52.6677801101 3 0 0 255 128.7028301887 0 255 255 5.2696810897 255 255 255 57.8412195098 3 0 0 255 41.0738255034 255 0 255 113.4047922066 255 255 255 38.2600315997 3...
result:
ok ok (10000 test cases)
Test #4:
score: -100
Wrong Answer
time: 18ms
memory: 3780kb
input:
10000 186 217 161 76 0 116 246 159 161 32 245 65 206 120 71 217 76 204 109 255 245 157 59 192 55 35 87 27 147 199 190 134 31 169 64 105 5 27 255 161 2 35 244 255 232 253 106 199 28 151 129 50 24 20 172 236 234 74 51 150 179 68 178 69 42 192 152 1 23 177 169 71 216 190 125 136 223 193 255 168 49 74 2...
output:
3 0 255 0 114.5652173913 255 255 0 77.4237384566 255 255 255 210.0566224404 3 0 0 255 56.9832402235 255 0 255 96.2235830476 255 255 255 0.0000000000 3 255 0 0 230.5851063830 255 0 255 5.3367944104 255 255 255 223.0286841312 3 0 255 0 241.5789473684 0 255 255 37.7876549973 255 255 255 42.0644286252 3...
result:
wrong answer Double parameter [name=d[1]] equals to 255000, violates the range [0, 10000] (test case 9326)