QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#714907 | #8081. Minimum Manhattan Distance | qzez# | AC ✓ | 87ms | 4064kb | C++14 | 563b | 2024-11-06 09:07:44 | 2024-11-06 09:07:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;using db=double;
using cp=complex<db>;
cp a,b,c,d;
void read(cp &x){
int a,b;scanf("%d%d",&a,&b);
x=cp(a,b);
}
db dist(cp x,cp y){
x-=y;
return sqrt(x.imag()*x.imag()+x.real()*x.real());
}
void Solve(){
read(a);read(b);read(c);read(d);
cp m1=(a+b)/2.0,m2=(c+d)/2.0;
// cerr<<dist(c,m2)<<'\n';
printf("%.10lf\n",fabs(m1.real()-m2.real())+fabs(m1.imag()-m2.imag())-dist(c,m2)*sqrt(2));
}
int main(){
int t=1;
scanf("%d",&t);
while(t--) Solve();
cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4020kb
input:
1 0 0 2 1 4 5 5 2
output:
4.2639320225
result:
ok Your answer is acceptable!^ ^
Test #2:
score: 0
Accepted
time: 83ms
memory: 4064kb
input:
100000 64184 -33682 59295 3067 16568 83379 -30901 17899 4747 16156 33365 80028 -41011 -93961 -89583 -95743 96914 -33206 12828 -88885 -93518 29681 -82022 42270 40225 76998 25677 84480 66361 -32945 94822 -81258 -17979 41800 -91442 80586 40229 -78184 30070 -89624 -21082 -94587 48262 -87979 -95197 91518...
output:
77664.4926864032 192928.3027014407 227607.1060353066 145831.4445800461 224138.5231894689 203168.4163226262 106258.7021872966 114459.0303484890 130191.3783434083 92639.9951336741 110927.1824394682 121482.2553263667 130471.0514280389 193239.8699309033 101942.1776022449 228879.0586081132 128129.5646587...
result:
ok Your answer is acceptable!^ ^
Test #3:
score: 0
Accepted
time: 82ms
memory: 4036kb
input:
100000 -18320 -12065 -63211 -70160 25465 23684 51590 90971 320 47201 7943 81396 -92700 -32637 -74486 -4692 99421 19908 91756 -28366 25529 -55621 18271 -78859 27654 -68417 31755 -96497 -26728 -28568 -50384 -393 -10805 -86093 7305 -27809 -64498 85696 -76254 19562 84518 11339 26149 17948 2447 55045 -13...
output:
126693.5251104599 147100.7153420607 119484.9246639657 110223.1867366585 130709.1080385253 92808.2702382451 118867.0018466377 297697.8711296911 213765.6021670809 90968.3578071120 165745.3674350864 184370.1691443061 184241.4668863199 132742.8313684500 129347.6125795355 119503.6265994220 155451.8100315...
result:
ok Your answer is acceptable!^ ^
Test #4:
score: 0
Accepted
time: 87ms
memory: 3904kb
input:
100000 37495 80384 -22610 56295 -62653 -47270 -62203 -6381 -86440 63964 25226 91598 62192 -71344 39815 -45590 -81947 13219 -50302 92935 70951 -12452 44060 -68999 68612 -63329 67331 -30225 21098 36822 -86721 85311 14179 56408 37664 -10185 -71446 -35104 -83185 -35928 62231 49184 -22420 -2128 -38074 -9...
output:
136120.8599278843 193733.8378780137 173156.7216895061 125031.8833013154 153543.3493283681 166748.4758589520 185481.0617343163 177488.0896438977 108138.4798974022 180039.8292054971 161614.8798608724 157287.7645108393 153821.0441204849 64625.5729642737 85310.0780332704 142744.0036289379 105454.5248094...
result:
ok Your answer is acceptable!^ ^
Test #5:
score: 0
Accepted
time: 87ms
memory: 4012kb
input:
100000 29660 -79759 63721 -76194 73610 -35151 84824 -12411 -87524 -63981 -79091 -72979 2216 18174 -8275 -10477 43042 -7367 6840 -22825 -37089 39403 -11737 74216 -38578 -60298 -11315 -54231 -74974 27413 -80834 23157 54452 -75442 29525 -46682 -90307 -93765 -98254 -98119 -89611 -83470 -51787 -86428 527...
output:
68793.5115528386 131031.7360151959 90807.3336320714 130385.8118566098 164741.4995122903 265321.8837562677 164666.5989041324 86404.2341932804 199326.1694970803 86550.2675616785 120915.3816180656 124345.8379354455 214598.2838239608 143475.1043659963 110486.5846793333 190341.2537372062 62166.1715781831...
result:
ok Your answer is acceptable!^ ^
Test #6:
score: 0
Accepted
time: 76ms
memory: 3944kb
input:
100000 -559 -590 -265 -338 671 670 -34 551 266 -278 -592 281 958 638 806 872 -34 809 -373 949 380 -847 962 -208 863 -691 927 578 -730 -913 -793 -956 -88 -133 -470 74 726 -585 769 -641 143 -383 -500 -361 836 580 434 512 -103 -967 554 -855 -226 383 -760 -57 920 749 626 979 202 392 -661 -403 -505 315 -...
output:
1299.4379365498 1601.1931324054 1669.8351286273 2480.5648537594 1560.0750563345 1443.2050121837 1303.2372893833 1042.3030673794 2227.7925552260 1408.9287187041 1608.7501069290 1105.6004872770 1662.5854584455 868.0753009575 1995.4705771543 1728.4533588583 1730.0476622805 1538.0356101900 915.583636741...
result:
ok Your answer is acceptable!^ ^
Test #7:
score: 0
Accepted
time: 68ms
memory: 4008kb
input:
100000 20 -100 98 -47 -10 21 -100 92 26 5 23 45 -48 -22 -13 -33 85 -56 88 -92 3 26 -100 -16 90 39 53 -1 17 -55 -67 -75 -88 31 -99 14 -58 -12 -64 -10 -76 -17 -46 -79 -13 92 77 56 95 -73 19 -34 -46 38 -5 4 20 -43 79 -4 -76 84 -41 89 -58 -38 -15 -55 -97 21 -76 23 -70 -78 -32 -46 70 91 50 -18 84 -91 100...
output:
162.9413792370 81.5577564579 135.3456930613 119.4426499101 61.5278640450 146.4580420472 119.3370208295 193.0000000000 103.5835661098 131.1386574898 186.9150721274 187.3082816414 160.3920493694 89.2799812734 99.1440092332 105.3857039287 192.0151549951 154.9955358922 75.8479182621 247.6360389693 238.5...
result:
ok Your answer is acceptable!^ ^
Test #8:
score: 0
Accepted
time: 67ms
memory: 4036kb
input:
100000 2 7 -6 8 -9 -5 -10 -7 2 4 2 8 -3 -10 -10 -2 4 0 -3 -2 8 -7 8 -10 -7 4 -3 -4 8 -7 8 -10 -10 4 2 4 8 -10 8 -7 4 1 5 6 -7 -4 -10 -4 8 1 6 5 -1 -8 -7 -3 -9 5 -6 8 2 -1 3 -2 -9 4 -10 7 6 -9 8 -1 -1 -4 3 -4 -10 -8 -7 -10 10 2 4 4 0 -7 -4 -4 -10 2 -7 8 4 -10 -1 -3 -9 -4 -6 -5 -1 2 8 4 1 8 -4 8 -7 -1...
output:
19.4188611699 12.9833518108 12.8786796564 19.3786796564 22.3786796564 18.3786796564 13.9773194914 17.0000000000 21.1690481052 11.9504902432 13.9644660941 15.4172374697 11.9807975948 22.2639320225 13.2573593129 21.9504902432 14.4807975948 11.0227507999 18.5845240526 4.4188611699 18.8786796564 18.4833...
result:
ok Your answer is acceptable!^ ^
Extra Test:
score: 0
Extra Test Passed