QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#575435 | #8081. Minimum Manhattan Distance | hahahalz# | AC ✓ | 158ms | 4000kb | C++20 | 724b | 2024-09-19 14:18:50 | 2024-09-19 14:18:51 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define lb long double
const int Max = 2*(int)1e3;
int mid[Max][Max],a[Max];
void solve() {
lb x1,x2,x3,x4,x5,x6,x7,x8;
lb a,b,c,d,r=0;
cin>>x1>>x2>>x3>>x4>>x5>>x6>>x7>>x8;
a=(x1+x3)/(lb)2.0,b=(x2+x4)/(lb)2.0,c=(x5+x7)/(lb)2.0,d=(x6+x8)/(lb)2.0;
r=(x8-x6)*(x8-x6)+(x5-x7)*(x5-x7);
r=sqrtl(2*r)/2;
lb ans=fabs(c-a)+fabs(b-d)-r;
cout<<fixed<<setprecision(12)<<ans<<"\n";
}
signed main() {
#ifdef ACM_LOCAL
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
int t=1;
cin>>t;
while(t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4000kb
input:
1 0 0 2 1 4 5 5 2
output:
4.263932022500
result:
ok Your answer is acceptable!^ ^
Test #2:
score: 0
Accepted
time: 158ms
memory: 3884kb
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.492686403209 192928.302701440661 227607.106035306656 145831.444580046046 224138.523189468861 203168.416322626161 106258.702187296652 114459.030348488983 130191.378343408275 92639.995133674132 110927.182439468239 121482.255326366726 130471.051428038909 193239.869930903345 101942.177602244961 22...
result:
ok Your answer is acceptable!^ ^
Test #3:
score: 0
Accepted
time: 153ms
memory: 3888kb
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.525110459845 147100.715342060716 119484.924663965713 110223.186736658541 130709.108038525300 92808.270238245117 118867.001846637719 297697.871129691147 213765.602167080849 90968.357807112018 165745.367435086443 184370.169144306107 184241.466886319906 132742.831368450060 129347.612579535546 11...
result:
ok Your answer is acceptable!^ ^
Test #4:
score: 0
Accepted
time: 157ms
memory: 3948kb
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.859927884283 193733.837878013711 173156.721689506123 125031.883301315389 153543.349328368101 166748.475858951970 185481.061734316275 177488.089643897734 108138.479897402200 180039.829205497133 161614.879860872375 157287.764510839320 153821.044120484881 64625.572964273681 85310.078033270376 14...
result:
ok Your answer is acceptable!^ ^
Test #5:
score: 0
Accepted
time: 151ms
memory: 3896kb
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.511552838594 131031.736015195902 90807.333632071429 130385.811856609836 164741.499512290303 265321.883756267727 164666.598904132365 86404.234193280384 199326.169497080302 86550.267561678473 120915.381618065551 124345.837935445484 214598.283823960833 143475.104365996329 110486.584679333333 1903...
result:
ok Your answer is acceptable!^ ^
Test #6:
score: 0
Accepted
time: 145ms
memory: 3900kb
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.437936549824 1601.193132405382 1669.835128627307 2480.564853759353 1560.075056334534 1443.205012183701 1303.237289383301 1042.303067379420 2227.792555225993 1408.928718704055 1608.750106929019 1105.600487276986 1662.585458445455 868.075300957536 1995.470577154287 1728.453358858273 1730.04766228...
result:
ok Your answer is acceptable!^ ^
Test #7:
score: 0
Accepted
time: 136ms
memory: 3872kb
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.941379236999 81.557756457854 135.345693061346 119.442649910105 61.527864045000 146.458042047225 119.337020829467 193.000000000000 103.583566109824 131.138657489806 186.915072127435 187.308281641358 160.392049369441 89.279981273412 99.144009233241 105.385703928745 192.015154995059 154.99553589221...
result:
ok Your answer is acceptable!^ ^
Test #8:
score: 0
Accepted
time: 133ms
memory: 3896kb
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.418861169916 12.983351810814 12.878679656440 19.378679656440 22.378679656440 18.378679656440 13.977319491406 17.000000000000 21.169048105155 11.950490243204 13.964466094067 15.417237469702 11.980797594797 22.263932022500 13.257359312881 21.950490243204 14.480797594797 11.022750799950 18.584524052...
result:
ok Your answer is acceptable!^ ^
Extra Test:
score: 0
Extra Test Passed