QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#576448#8081. Minimum Manhattan DistanceSDNUyuqi#AC ✓301ms3968kbC++23490b2024-09-19 20:23:422024-09-19 20:23:43

Judging History

你现在查看的是最新测评结果

  • [2024-09-19 20:23:43]
  • 评测
  • 测评结果:AC
  • 用时:301ms
  • 内存:3968kb
  • [2024-09-19 20:23:42]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

#define endl "\n"

typedef long long ll;

const int N = 1e6 + 100;

int main()
{
	int T;
	cin >> T;
	while (T--)
	{
		double a, b, c, d, e, f, g, h;
		cin >> a >> b >> c >> d >> e >> f >> g >> h;
		double x1 = (a + c) / 2, x2 = (e + g) / 2,
			y1 = (b + d) / 2, y2 = (f + h) / 2;
		cout << setprecision(10) << abs(x1 - x2) + abs(y1 - y2) - sqrt(2 * (x2 - e) * (x2 - e) + 2 * (y2 - f) * (y2 - f)) << endl;
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3780kb

input:

1
0 0 2 1
4 5 5 2

output:

4.263932023

result:

ok Your answer is acceptable!^ ^

Test #2:

score: 0
Accepted
time: 300ms
memory: 3964kb

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.49269
192928.3027
227607.106
145831.4446
224138.5232
203168.4163
106258.7022
114459.0303
130191.3783
92639.99513
110927.1824
121482.2553
130471.0514
193239.8699
101942.1776
228879.0586
128129.5647
83809.43792
232037.1188
147990.3805
68023.19841
143263.011
134900.1394
188419.6425
164399.0484
16...

result:

ok Your answer is acceptable!^ ^

Test #3:

score: 0
Accepted
time: 285ms
memory: 3908kb

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.5251
147100.7153
119484.9247
110223.1867
130709.108
92808.27024
118867.0018
297697.8711
213765.6022
90968.35781
165745.3674
184370.1691
184241.4669
132742.8314
129347.6126
119503.6266
155451.81
146746.1877
130546.0903
190846.5627
150883.0557
64679.02255
103605.665
85541.30125
187599.3477
2733...

result:

ok Your answer is acceptable!^ ^

Test #4:

score: 0
Accepted
time: 259ms
memory: 3928kb

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.8599
193733.8379
173156.7217
125031.8833
153543.3493
166748.4759
185481.0617
177488.0896
108138.4799
180039.8292
161614.8799
157287.7645
153821.0441
64625.57296
85310.07803
142744.0036
105454.5248
151684.8447
132576.3922
117379.719
150165.6546
140632.0311
149164.6346
135187.3108
128603.8496
1...

result:

ok Your answer is acceptable!^ ^

Test #5:

score: 0
Accepted
time: 301ms
memory: 3860kb

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.51155
131031.736
90807.33363
130385.8119
164741.4995
265321.8838
164666.5989
86404.23419
199326.1695
86550.26756
120915.3816
124345.8379
214598.2838
143475.1044
110486.5847
190341.2537
62166.17158
169293.7222
131246.5771
85430.87582
112925.1934
166910.6252
140177.9163
176959.5594
107247.3484
2...

result:

ok Your answer is acceptable!^ ^

Test #6:

score: 0
Accepted
time: 249ms
memory: 3968kb

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.437937
1601.193132
1669.835129
2480.564854
1560.075056
1443.205012
1303.237289
1042.303067
2227.792555
1408.928719
1608.750107
1105.600487
1662.585458
868.075301
1995.470577
1728.453359
1730.047662
1538.03561
915.5836367
1269.738182
1482.744325
1353.823513
1695.191011
1334.5
1133.505814
1627.29...

result:

ok Your answer is acceptable!^ ^

Test #7:

score: 0
Accepted
time: 234ms
memory: 3908kb

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.9413792
81.55775646
135.3456931
119.4426499
61.52786405
146.458042
119.3370208
193
103.5835661
131.1386575
186.9150721
187.3082816
160.3920494
89.27998127
99.14400923
105.3857039
192.015155
154.9955359
75.84791826
247.636039
238.5983871
95.5382439
183.0691999
194.591879
60.19469219
150.8150677
1...

result:

ok Your answer is acceptable!^ ^

Test #8:

score: 0
Accepted
time: 206ms
memory: 3868kb

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.41886117
12.98335181
12.87867966
19.37867966
22.37867966
18.37867966
13.97731949
17
21.16904811
11.95049024
13.96446609
15.41723747
11.98079759
22.26393202
13.25735931
21.95049024
14.48079759
11.0227508
18.58452405
4.41886117
18.87867966
18.48335181
16.79289322
15.67157288
24.79289322
21.26393202...

result:

ok Your answer is acceptable!^ ^

Extra Test:

score: 0
Extra Test Passed