QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#146512 | #1781. Joint Jog Jam | mojospy | WA | 1ms | 3976kb | C++14 | 1.5kb | 2023-08-22 16:08:23 | 2023-08-22 16:08:25 |
Judging History
answer
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
const double N=1e-9;
double kx,ky,kex,key,ox,oy,oex,oey;
double add;
bool flag=false;
double dx,dy;
double dis(double x,double y,double xi,double yi){
return sqrt((x-xi)*(x-xi)+(y-yi)*(y-yi));
}
bool isvaild(double x,double y){
bool xi=(x>=min(ox,oex)&&x<=max(ox,oex));
bool yi=(y>=min(oy,oey)&&y<=max(oy,oey));
return xi&&yi;
}
double f(double x,double y){
double cur=dis(x,y,kx,ky);
double nextx,nexty;
if(flag){
nextx=ox,nexty=oy+(dy*cur);
}
else{
double addx=sqrt((cur*cur)/(add*add+1));
double addy=add*addx;
nextx=ox+dx*addx,nexty=oy+dy*addy;
}
if(!isvaild(nextx,nexty)){
nextx=oex,nexty=oey;
}
//cout<<"\xb2\xe2\xca\xd4"<<x<<" "<<y<<" "<<nextx<<" "<<nexty<<" "<<endl;
return dis(x,y,nextx,nexty);
}
int main(){
cin>>kx>>ky>>ox>>oy>>kex>>key>>oex>>oey;
double d1=dis(kx,ky,ox,oy);
double d2=dis(kex,key,oex,oey);
if(oex==ox) flag=true;
else add=(oey-oy)/(oex-ox);
//cout<<add<<endl;
dy=(oey>oy?1:-1);
dx=(oex>ox?1:-1);
double lx=kx,ly=ky,rx=kex,ry=key;
while(dis(lx,ly,rx,ry)>N){
//cout<<"\xcf\xd6\xd4\xda:"<<lx<<" "<<ly<<" "<<rx<<" "<<ry<<" "<<f(lx,ly)<<" "<<N<<endl;
//cout<<endl;
double xtemp=(rx-lx)/3;
double ytemp=(ry-ly)/3;
double Lx=lx+xtemp,Rx=rx-xtemp;
double Ly=ly+ytemp,Ry=ry-ytemp;
if(f(Lx,Ly)>f(Rx,Ry)) rx=Rx,ry=Ry;
else lx=Lx,ly=Ly;
}
cout<<fixed<<setprecision(10)<<max(f(lx,ly),max(d1,d2));
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3868kb
input:
6341 4789 1787 7737 3074 8627 347 3128
output:
6138.0395893151
result:
ok single line: '6138.0395893151'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3972kb
input:
8306 8911 8306 8911 5953 8206 7810 2265
output:
6224.4622257670
result:
ok single line: '6224.4622257670'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3856kb
input:
5248 4399 3402 6077 3545 4416 3545 4416
output:
2494.6743274424
result:
ok single line: '2494.6743274424'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
6698 6016 4986 1397 4986 1397 8126 7944
output:
7261.0473762399
result:
ok single line: '7261.0473762399'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
309 5619 931 4437 931 4437 6143 9730
output:
7428.3775482941
result:
ok single line: '7428.3775482941'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3972kb
input:
7620 9736 6864 9295 7620 9736 6864 9295
output:
875.2239713353
result:
ok single line: '875.2239713353'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
2832 1324 2820 6401 1594 6090 6976 6688
output:
5415.1203126062
result:
ok single line: '5415.1203126062'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
4041 7446 4041 7446 1595 1821 9801 8346
output:
10483.9907001103
result:
ok single line: '10483.9907001103'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
1421 1120 6073 7271 9893 5414 9893 5414
output:
7712.0623052462
result:
ok single line: '7712.0623052462'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
516 6917 7220 3124 7220 3124 7789 5412
output:
7702.6271492264
result:
ok single line: '7702.6271492264'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
8209 6363 6812 7512 6812 7512 6906 9850
output:
2339.8888862508
result:
ok single line: '2339.8888862508'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3972kb
input:
9147 2208 1899 5784 9147 2208 1899 5784
output:
8082.1581276290
result:
ok single line: '8082.1581276290'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3972kb
input:
2945 5437 4228 8436 187 2320 8837 921
output:
8762.4026956081
result:
ok single line: '8762.4026956081'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3964kb
input:
30 2151 30 2151 6055 2731 2649 8205
output:
6447.1320755821
result:
ok single line: '6447.1320755821'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
687 7817 8105 9795 4932 6909 4932 6909
output:
7677.1875058513
result:
ok single line: '7677.1875058513'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3720kb
input:
9282 9827 8239 5906 8239 5906 9232 7955
output:
4057.3501204604
result:
ok single line: '4057.3501204604'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
9848 6177 54 5596 54 5596 680 8173
output:
9811.2179162426
result:
ok single line: '9811.2179162426'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
700 5458 7727 7673 700 5458 7727 7673
output:
7367.8323813724
result:
ok single line: '7367.8323813724'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
831 1247 8982 8179 9631 6313 6357 7254
output:
10700.0665885778
result:
ok single line: '10700.0665885778'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
8973 4023 8973 4023 6905 7628 7712 5286
output:
2477.1380663984
result:
ok single line: '2477.1380663984'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3972kb
input:
2148 2841 6882 627 7536 1351 7536 1351
output:
5226.1412150840
result:
ok single line: '5226.1412150840'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
2675 2674 5729 6548 5729 6548 8636 4819
output:
4933.0307114390
result:
ok single line: '4933.0307114390'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
4753 2036 870 418 870 418 5382 6022
output:
7194.6480108481
result:
ok single line: '7194.6480108481'
Test #24:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
8243 3651 3693 2486 8243 3651 3693 2486
output:
4696.7781510308
result:
ok single line: '4696.7781510308'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
989 2849 6803 8319 4817 3260 3337 4005
output:
7982.6997939294
result:
ok single line: '7982.6997939294'
Test #26:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
5000 2614 5000 2614 54 3582 1722 8855
output:
5530.5291790208
result:
ok single line: '5530.5291790208'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3720kb
input:
9512 2313 1623 8838 4639 8790 4639 8790
output:
10237.7705580854
result:
ok single line: '10237.7705580854'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
8108 6868 8859 2824 8859 2824 4155 2530
output:
4713.1785453131
result:
ok single line: '4713.1785453131'
Test #29:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
8968 8132 7931 7353 7931 7353 2016 8554
output:
6035.6959830661
result:
ok single line: '6035.6959830661'
Test #30:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
9037 6561 44 7763 9037 6561 44 7763
output:
9072.9737682857
result:
ok single line: '9072.9737682857'
Test #31:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
5035 8317 7561 9349 632 8830 9845 9495
output:
9236.9688751235
result:
ok single line: '9236.9688751235'
Test #32:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
726 6185 726 6185 3208 6068 1568 2763
output:
3689.5291027447
result:
ok single line: '3689.5291027447'
Test #33:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
3682 6468 539 6143 807 9155 807 9155
output:
3159.7585350783
result:
ok single line: '3159.7585350783'
Test #34:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
3339 2273 573 118 573 118 6301 9372
output:
10883.3129147333
result:
ok single line: '10883.3129147333'
Test #35:
score: 0
Accepted
time: 1ms
memory: 3856kb
input:
9181 4377 1634 6923 1634 6923 5426 7177
output:
7964.8807272928
result:
ok single line: '7964.8807272928'
Test #36:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
4234 9717 6920 4555 4234 9717 6920 4555
output:
5819.0067881040
result:
ok single line: '5819.0067881040'
Test #37:
score: 0
Accepted
time: 1ms
memory: 3972kb
input:
5815 4990 7189 8317 8644 3587 2423 1235
output:
6650.7702561433
result:
ok single line: '6650.7702561433'
Test #38:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
1161 3353 1161 3353 6090 7574 6755 569
output:
7036.4941554726
result:
ok single line: '7036.4941554726'
Test #39:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
9568 490 3449 8116 6554 9226 6554 9226
output:
9777.4248654745
result:
ok single line: '9777.4248654745'
Test #40:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
1684 7949 5208 7573 5208 7573 1073 1385
output:
7442.4168789446
result:
ok single line: '7442.4168789446'
Test #41:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
1128 1579 963 536 963 536 3633 527
output:
2670.0151684962
result:
ok single line: '2670.0151684962'
Test #42:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
4141 6505 4327 5753 4141 6505 4327 5753
output:
774.6612162746
result:
ok single line: '774.6612162746'
Test #43:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
4204 2452 835 6550 4605 1882 5068 5558
output:
5305.0697450646
result:
ok single line: '5305.0697450646'
Test #44:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
5040 5468 5040 5468 7612 1861 9909 7564
output:
6148.2044533343
result:
ok single line: '6148.2044533343'
Test #45:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
2257 4431 6299 8834 7400 3745 7400 3745
output:
5976.9702190993
result:
ok single line: '5976.9702190993'
Test #46:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
3156 8381 2894 7130 2894 7130 736 8066
output:
2352.2457354622
result:
ok single line: '2352.2457354622'
Test #47:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
8498 955 763 7662 763 7662 2710 9816
output:
10237.8744864352
result:
ok single line: '10237.8744864352'
Test #48:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
126 3639 1986 6867 126 3639 1986 6867
output:
3725.5313714959
result:
ok single line: '3725.5313714959'
Test #49:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
8910 5983 3692 902 3691 7920 6373 5978
output:
7283.1370301540
result:
ok single line: '7283.1370301540'
Test #50:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
7755 9476 7755 9476 2938 1429 1235 5946
output:
4827.3696771637
result:
ok single line: '4827.3696771637'
Test #51:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
9611 4444 7640 2758 6008 5349 6008 5349
output:
2593.7303252266
result:
ok single line: '2593.7303252266'
Test #52:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
9670 85 4211 3241 4211 3241 3200 7095
output:
6305.6337508612
result:
ok single line: '6305.6337508612'
Test #53:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
3439 5092 315 2977 315 2977 5474 3136
output:
5161.4496025826
result:
ok single line: '5161.4496025826'
Test #54:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
7895 8770 9632 7244 7895 8770 9632 7244
output:
2312.1083452122
result:
ok single line: '2312.1083452122'
Test #55:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
233 3047 1950 6612 1928 1868 5407 8622
output:
7597.3651353611
result:
ok single line: '7597.3651353611'
Test #56:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
753 3327 753 3327 8815 9153 7801 4311
output:
4947.0354759189
result:
ok single line: '4947.0354759189'
Test #57:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
2149 6810 6800 7345 5207 5603 5207 5603
output:
4681.6691467894
result:
ok single line: '4681.6691467894'
Test #58:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
7230 2383 174 1876 174 1876 6188 2933
output:
7074.1914732357
result:
ok single line: '7074.1914732357'
Test #59:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
2744 8461 7620 8279 7620 8279 6744 6289
output:
4879.3954543570
result:
ok single line: '4879.3954543570'
Test #60:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
728 1471 619 9889 728 1471 619 9889
output:
8418.7056606108
result:
ok single line: '8418.7056606108'
Test #61:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
4246 4618 24 7259 1813 6620 379 3623
output:
4979.9764055666
result:
ok single line: '4979.9764055666'
Test #62:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
1818 614 1818 614 4383 9324 1879 2894
output:
6900.3562226888
result:
ok single line: '6900.3562226888'
Test #63:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
4232 8744 3238 7751 2771 6516 2771 6516
output:
1405.0213521509
result:
ok single line: '1405.0213521509'
Test #64:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
6816 7329 3287 7544 3287 7544 7921 9611
output:
5074.0954858970
result:
ok single line: '5074.0954858970'
Test #65:
score: 0
Accepted
time: 1ms
memory: 3976kb
input:
8542 9379 3445 725 3445 725 3102 705
output:
10043.4618035815
result:
ok single line: '10043.4618035815'
Test #66:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
5120 2153 9076 8546 5120 2153 9076 8546
output:
7518.0040569289
result:
ok single line: '7518.0040569289'
Test #67:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
891 1606 7731 1521 750 3295 5665 2089
output:
6840.5281228864
result:
ok single line: '6840.5281228864'
Test #68:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
272 1515 272 1515 5989 7629 3838 5257
output:
3202.0594935135
result:
ok single line: '3202.0594935135'
Test #69:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
626 5435 2810 1991 345 8563 345 8563
output:
4078.1113275633
result:
ok single line: '4078.1113275633'
Test #70:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
1270 2635 5127 7905 5127 7905 8244 629
output:
7915.5457802984
result:
ok single line: '7915.5457802984'
Test #71:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
2546 6136 6065 5785 6065 5785 1697 2096
output:
5717.3547204979
result:
ok single line: '5717.3547204979'
Test #72:
score: 0
Accepted
time: 1ms
memory: 3724kb
input:
748 7324 4616 6815 748 7324 4616 6815
output:
3901.3465624064
result:
ok single line: '3901.3465624064'
Test #73:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
1273 5193 3473 1481 5751 1882 7905 8278
output:
6748.9652540223
result:
ok single line: '6748.9652540223'
Test #74:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
7232 6036 7232 6036 7448 9462 7296 2252
output:
7211.6020411556
result:
ok single line: '7211.6020411556'
Test #75:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
2928 1809 883 7079 1690 1054 1690 1054
output:
5652.8687407369
result:
ok single line: '5652.8687407369'
Test #76:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
2602 5747 5130 3258 5130 3258 2232 3086
output:
3547.6619061010
result:
ok single line: '3547.6619061010'
Test #77:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
498 6776 5844 1680 5844 1680 2919 7169
output:
7385.7248797935
result:
ok single line: '7385.7248797935'
Test #78:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
6089 9622 7669 9967 6089 9622 7669 9967
output:
1617.2275659288
result:
ok single line: '1617.2275659288'
Test #79:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
5042 1120 1686 3425 4142 871 1154 4602
output:
4780.0109832510
result:
ok single line: '4780.0109832510'
Test #80:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
1367 8923 1367 8923 9625 3561 2911 9243
output:
8795.6193642063
result:
ok single line: '8795.6193642063'
Test #81:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
984 1978 9744 4404 9459 2343 9459 2343
output:
9089.7236481644
result:
ok single line: '9089.7236481644'
Test #82:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
3189 6830 3886 8511 3886 8511 6715 3747
output:
5540.6621445455
result:
ok single line: '5540.6621445455'
Test #83:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
7953 8650 5038 8611 5038 8611 8726 2046
output:
7529.9780212163
result:
ok single line: '7529.9780212163'
Test #84:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
5806 6870 7894 4462 5806 6870 7894 4462
output:
3187.1943775051
result:
ok single line: '3187.1943775051'
Test #85:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
3524 729 5006 7620 2209 1907 5397 2097
output:
7048.5604913344
result:
ok single line: '7048.5604913344'
Test #86:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
4364 7956 4364 7956 3007 5705 6279 2072
output:
4889.2405340707
result:
ok single line: '4889.2405340707'
Test #87:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
8451 8416 2304 3388 6431 5332 6431 5332
output:
7941.4351977461
result:
ok single line: '7941.4351977461'
Test #88:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
3215 560 8308 1520 8308 1520 4278 9723
output:
9139.4807839395
result:
ok single line: '9139.4807839395'
Test #89:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
5555 5549 2539 7223 2539 7223 8615 4483
output:
6665.2363799043
result:
ok single line: '6665.2363799043'
Test #90:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
1133 1126 527 4924 1133 1126 527 4924
output:
3846.0421214542
result:
ok single line: '3846.0421214542'
Test #91:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
6443 7141 4055 2804 2646 3058 4204 5168
output:
4950.9709148812
result:
ok single line: '4950.9709148812'
Test #92:
score: 0
Accepted
time: 1ms
memory: 3960kb
input:
8714 7547 8714 7547 3440 4149 3006 7669
output:
3546.6541979731
result:
ok single line: '3546.6541979731'
Test #93:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
6661 6695 1644 6151 8667 7662 8667 7662
output:
5046.4071377565
result:
ok single line: '5046.4071377565'
Test #94:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
6532 7859 3890 3213 3890 3213 3353 3993
output:
5344.6683713772
result:
ok single line: '5344.6683713772'
Test #95:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
4567 7388 2561 8979 2561 8979 4377 1148
output:
8038.8069388436
result:
ok single line: '8038.8069388436'
Test #96:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
9020 5536 334 9443 9020 5536 334 9443
output:
9524.2451144435
result:
ok single line: '9524.2451144435'
Test #97:
score: -100
Wrong Answer
time: 0ms
memory: 3904kb
input:
4711 2021 4711 2021 9999 10000 9999 10000
output:
0.0000000000
result:
wrong answer 1st lines differ - expected: '0', found: '0.0000000000'