QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#452443#6831. Known as the Fruit BrothermshcherbaAC ✓3151ms4072kbC++205.9kb2024-06-23 18:59:392024-06-23 18:59:41

Judging History

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

  • [2024-06-23 18:59:41]
  • 评测
  • 测评结果:AC
  • 用时:3151ms
  • 内存:4072kb
  • [2024-06-23 18:59:39]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

const db EPS = 1e-9;
const db INF = 1e9;

template<typename T>
void updMin(T& a, T b)
{
	a = min(a, b);
}

struct Pt
{
	db x, y;
	Pt operator+(const Pt& p) const
	{
		return {x + p.x, y + p.y};
	}
	Pt operator-(const Pt& p) const
	{
		return {x - p.x, y - p.y};
	}
	Pt operator*(db d) const
	{
		return {x * d, y * d};
	}
	Pt operator/(db d) const
	{
		return {x / d, y / d};
	}
};

db sq(const Pt& p)
{
	return p.x * p.x + p.y * p.y;
}

db abs(const Pt& p)
{
	return sqrt(sq(p));
}

int sgn(db x)
{
	return (EPS < x) - (x < -EPS);
}

Pt perp(const Pt& p)
{
	return {-p.y, p.x};
}

db dot(const Pt& p, const Pt& q)
{
	return p.x * q.x + p.y * q.y;
}

db cross(const Pt& p, const Pt& q)
{
	return p.x * q.y - p.y * q.x;
}

db orient(const Pt& p, const Pt& q, const Pt& r)
{
	return cross(q - p, r - p) / abs(q - p);
}

ostream& operator<<(ostream& os, const Pt& p)
{
	return os << "(" << p.x << "," << p.y << ")";
}

struct Line
{
	Pt n;
	db c;
	Line(const Pt& p, const Pt& q):
		n(perp(q - p)), c(-dot(n, p)) {}
	db side(const Pt& p) const
	{
		return dot(n, p) + c;
	}
	db sqDist(const Pt& p) const
	{
		return side(p) * side(p) / (db)sq(n);
	}
	Pt proj(const Pt& p) const
	{
		return p - n * side(p) / sq(n);
	}
};

bool inDisk(const Pt& a, const Pt& b, const Pt& p)
{
	return sgn(dot(a - p, b - p)) <= 0;
}

bool onSegment(const Pt& a, const Pt& b, const Pt& p)
{
	return sgn(orient(a, b, p)) == 0 && inDisk(a, b, p);
}

bool properInter(const Pt& a, const Pt& b, const Pt& c, const Pt& d)
{
	db oa = orient(c, d, a);
	db ob = orient(c, d, b);
	db oc = orient(a, b, c);
	db od = orient(a, b, d);
	return sgn(oa) * sgn(ob) == -1 && sgn(oc) * sgn(od) == -1;
}

vector<Pt> circleLine(const Pt& o, db r, const Line& l)
{
	db h2 = r * r - l.sqDist(o);
	if (sgn(h2) == -1)
		return {};
	Pt p = l.proj(o);
	if (sgn(h2) == 0)
		return {p};
	Pt h = perp(l.n) * sqrt(h2) / abs(l.n);
	return {p - h, p + h};
}

/**
 * Description: Returns the Minkowski sum of two convex polygons.
 **/
vector<Pt> minkowskiSum(const vector<Pt>& v1, const vector<Pt>& v2)
{
	if (v1.empty() || v2.empty())
		return {};
	if (SZ(v1) == 1 && SZ(v2) == 1)
		return {v1[0] + v2[0]};
	auto comp = [](const Pt& p, const Pt& q)
	{
		return sgn(p.x - q.x) < 0
			|| (sgn(p.x - q.x) == 0
			&& sgn(p.y - q.y) < 0);
	};
	int i1 = min_element(ALL(v1), comp) - v1.begin();
	int i2 = min_element(ALL(v2), comp)	- v2.begin();
	vector<Pt> res;
	int n1 = SZ(v1), n2 = SZ(v2),
		j1 = 0, j2 = 0;
	while (j1 < n1 || j2 < n2)
	{
		const Pt& p1 = v1[(i1 + j1) % n1];
		const Pt& q1 = v1[(i1 + j1 + 1) % n1];
		const Pt& p2 = v2[(i2 + j2) % n2];
		const Pt& q2 = v2[(i2 + j2 + 1) % n2];
		if (SZ(res) >= 2 && onSegment(res[SZ(res) - 2], p1 + p2, res.back()))
			res.pop_back();
		res.PB(p1 + p2);
		int s = sgn(cross(q1 - p1, q2 - p2));
		if (j1 < n1 && (j2 == n2 || s > 0
			|| (s == 0 && (SZ(res) < 2
			|| sgn(dot(res.back()
			- res[SZ(res) - 2],
			q1 + p2 - res.back())) > 0))))
			j1++;
		else
			j2++;
	}
	if (SZ(res) > 2	&& onSegment(res[SZ(res) - 2], res[0], res.back()))
		res.pop_back();
	return res;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int n, m, r;
	cin >> n >> m >> r;
	vector<Pt> vertices;
	FOR(i, 0, n)
	{
		db x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		vertices.PB({x1, y1});
		vertices.PB({x2, y1});
		vertices.PB({x2, y2});
		vertices.PB({x1, y2});
	}
	FOR(i, 0, m)
	{
		db x, y;
		cin >> x >> y;
		vertices.PB({x, y});
	}
	db xs, ys, xt, yt;
	cin >> xs >> ys >> xt >> yt;
	vertices.PB({xs, ys});
	vertices.PB({xt, yt});
	int k = SZ(vertices);
	vector dist(k, vector<db>(k, INF));
	auto check = [&](const Pt& p1, const Pt& p2) -> bool
	{
		FOR(l, 0, n)
		{
			auto minkSum = minkowskiSum({vertices.begin() + 4 * l, vertices.begin() + 4 * (l + 1)}, {p1 * (-1), p2 * (-1)});
			bool inside = true;
			FOR(p, 0, SZ(minkSum))
			{
				Pt q1 = minkSum[p], q2 = minkSum[(p + 1) % SZ(minkSum)];
				inside &= sgn(orient(q1, q2, {0, 0})) > 0;
			}
			if (inside)
				return false;
		}
		return true;
	};
	auto checkPoint = [&](const Pt& pt) -> bool
	{
		FOR(l, 0, n)
		{
			bool inside = true;
			FOR(p, 0, 4)
			{
				Pt q1 = vertices[4 * l + p], q2 = vertices[4 * l + (p + 1) % 4];
				inside &= sgn(orient(q1, q2, pt)) >= 0;
			}
			if (inside)
				return false;
		}
		return true;
	};
	FOR(i, 0, k)
	{
		FOR(j, 0, k)
		{
			if (i == j)
			{
				dist[i][j] = 0;
				continue;
			}
			Pt p1 = vertices[i], p2 = vertices[j];
			bool blast = 4 * n <= i && i < 4 * n + m;
			if (check(p1, p2))
			{
				db d = abs(p2 - p1);
				if (blast)
					d = max(0.0, d - r);
				updMin(dist[i][j], d);
			}
			if (blast)
			{
				FOR(l, 0, n)
				{
					FOR(p, 0, 4)
					{
						Pt q1 = vertices[4 * l + p], q2 = vertices[4 * l + (p + 1) % 4];
						Line q12(q1, q2);
						vector<Pt> vec = circleLine(p1, r, q12);
						for (const Pt& pt : vec)
						{
							if (onSegment(q1, q2, pt) && check(pt, p2))
							{
								updMin(dist[i][j], abs(p2 - pt));
							}
						}
					}
				}
				if (r < abs(p2 - p1) - EPS)
				{
					Pt pt = p1 + (p2 - p1) / abs(p2 - p1) * r;
					if (check(pt, p2) && checkPoint(pt))
					{
						updMin(dist[i][j], abs(p2 - pt));
					}
				}
				else
				{
					dist[i][j] = 0;
				}
			}
		}
	}
	FOR(kk, 0, k)
		FOR(i, 0, k)
			FOR(j, 0, k)
				updMin(dist[i][j], dist[i][kk] + dist[kk][j]);
	cout << dist[k - 2][k - 1] << "\n";
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 2 2
0 2 7 4
-3 3
8 2
1 1 6 6

output:

9.5432037669

result:

ok found '9.5432038', expected '9.5432038', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

1 2 3
0 2 7 4
-1 4
8 2
1 1 6 6

output:

7.9303914292

result:

ok found '7.9303914', expected '7.9303914', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

1 2 2
2 2 7 4
-1 4
8 2
1 1 6 6

output:

7.6344136152

result:

ok found '7.6344136', expected '7.6344136', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

1 2 1
0 2 7 4
-4 4
8 2
1 1 6 6

output:

9.7387688827

result:

ok found '9.7387689', expected '9.7387689', error '0.0000000'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

1 2 2
0 2 7 5
-4 4
8 2
1 1 6 6

output:

9.6475590344

result:

ok found '9.6475590', expected '9.6475590', error '0.0000000'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

1 0 114514
0 0 6 2
2 -1 5 3

output:

7.5373191880

result:

ok found '7.5373192', expected '7.5373192', error '0.0000000'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3856kb

input:

5 4 10
1 -99999 9 99999
11 -99999 19 99999
21 -99999 23 99999
-99999 999999 99999 1000000
-99999 -1000000 99999 -999999
0 0
10 0
20 0
24 7
-1 0 30 7

output:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

5 3 10
1 -99999 9 99999
11 -99999 19 99999
21 -99999 23 99999
-99999 999999 99999 1000000
-99999 -1000000 99999 -999999
0 0
10 0
20 0
-1 0 30 7

output:

3.2065556157

result:

ok found '3.2065556', expected '3.2065556', error '0.0000000'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3852kb

input:

5 4 1
1 -99999 9 99999
11 -99999 19 99999
21 -99999 23 99999
-99999 999999 99999 1000000
-99999 -1000000 99999 -999999
0 0
10 0
20 0
24 7
-1 0 30 7

output:

200013.0002500197

result:

ok found '200013.0002500', expected '200013.0002500', error '0.0000000'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

1 1 6
-999999 2 999999 7
1 1
0 0 8 8

output:

8.4852813742

result:

ok found '8.4852814', expected '8.4852814', error '0.0000000'

Test #11:

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

input:

1 1 10
-9999 9 9999 10
0 1
0 0 114 514

output:

516.5140340657

result:

ok found '516.5140341', expected '516.5140341', error '0.0000000'

Test #12:

score: 0
Accepted
time: 123ms
memory: 4064kb

input:

29 7 193
19 575 27 714
36 575 44 717
55 575 65 698
75 575 82 755
98 575 105 641
118 575 127 812
168 575 176 888
226 575 234 905
279 575 288 917
287 0 299 496
328 150 335 733
343 153 350 736
360 134 368 717
377 191 383 774
397 77 404 660
415 248 423 831
437 0 444 536
459 324 466 907
491 0 499 548
510...

output:

434.2481535895

result:

ok found '434.2481536', expected '434.2481536', error '0.0000000'

Test #13:

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

input:

29 7 133
19 575 27 714
36 575 44 717
55 575 65 698
75 575 82 755
98 575 105 641
118 575 127 812
168 575 176 888
226 575 234 905
279 575 288 917
287 0 299 496
328 150 335 733
343 153 350 736
360 134 368 717
377 191 383 774
397 77 404 660
415 248 423 831
437 0 444 536
459 324 466 907
491 0 499 548
510...

output:

947.0290416440

result:

ok found '947.0290416', expected '947.0290416', error '0.0000000'

Test #14:

score: 0
Accepted
time: 207ms
memory: 3992kb

input:

38 7 133
75 575 82 755
98 575 105 641
101 661 109 800
118 575 127 650
118 661 126 803
137 661 147 784
168 575 176 888
226 575 234 905
279 575 288 917
287 0 299 496
328 150 335 482
334 516 338 668
343 153 350 482
343 516 347 671
354 516 358 653
360 134 368 482
364 516 367 705
376 516 380 602
377 191 ...

output:

929.5626560765

result:

ok found '929.5626561', expected '929.5626561', error '0.0000000'

Test #15:

score: 0
Accepted
time: 396ms
memory: 4000kb

input:

38 21 133
75 575 82 755
98 575 105 641
101 661 109 800
118 575 127 650
118 661 126 803
137 661 147 784
168 575 176 888
226 575 234 905
279 575 288 917
287 0 299 496
328 150 335 482
334 516 338 668
343 153 350 482
343 516 347 671
354 516 358 653
360 134 368 482
364 516 367 705
376 516 380 602
377 191...

output:

218.2473408445

result:

ok found '218.2473408', expected '218.2473408', error '0.0000000'

Test #16:

score: 0
Accepted
time: 396ms
memory: 4072kb

input:

40 28 56
75 656 82 755
95 695 99 775
101 661 109 672
101 776 109 800
110 695 114 761
118 661 126 672
122 695 128 770
137 661 147 784
168 575 176 888
226 575 234 905
279 575 288 917
287 0 299 496
328 150 335 482
334 516 338 668
343 153 350 482
343 516 347 671
354 516 358 653
360 134 368 482
364 516 3...

output:

794.0724832055

result:

ok found '794.0724832', expected '794.0724832', error '0.0000000'

Test #17:

score: 0
Accepted
time: 290ms
memory: 4068kb

input:

40 28 31
75 656 82 755
95 695 99 775
101 661 109 672
101 776 109 800
110 695 114 761
118 661 126 672
122 695 128 770
137 661 147 784
168 575 176 888
226 575 234 905
279 575 288 917
287 0 299 496
328 150 335 482
334 516 338 668
343 153 350 482
343 516 347 671
354 516 358 653
360 134 368 482
364 516 3...

output:

1181.3373896016

result:

ok found '1181.3373896', expected '1181.3373896', error '0.0000000'

Test #18:

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

input:

40 28 31
101 661 109 672
118 661 126 672
101 776 109 800
707 396 715 979
343 153 350 482
226 575 234 905
459 324 466 482
592 56 599 639
75 656 82 755
354 516 358 653
328 150 335 482
377 191 383 482
491 0 499 548
397 77 404 482
557 353 564 564
110 695 114 761
684 0 691 550
387 516 392 756
122 695 128...

output:

1181.3373896016

result:

ok found '1181.3373896', expected '1181.3373896', error '0.0000000'

Test #19:

score: 0
Accepted
time: 5ms
memory: 3896kb

input:

12 1 695
281 0 284 2110
199 0 201 2110
48 0 51 2110
159 0 161 2109
70 0 73 2110
218 0 221 2110
133 0 138 2110
191 0 194 2109
168 0 171 2110
93 0 96 2109
241 0 244 2109
231 0 234 2110
404 288
402 139 29 1902

output:

1166.2913829618

result:

ok found '1166.2913830', expected '1166.2913830', error '0.0000000'

Test #20:

score: 0
Accepted
time: 42ms
memory: 3996kb

input:

36 2 695
133 0 138 2110
342 253 442 257
70 0 73 2110
281 0 284 2110
93 0 96 2109
168 0 171 2110
315 82 319 372
354 103 358 171
372 283 376 320
314 40 364 44
231 0 234 2110
306 193 310 407
338 291 342 377
328 50 332 177
425 260 429 326
27 1732 31 1869
38 1819 42 1956
362 181 428 185
420 107 424 172
4...

output:

1169.3632464733

result:

ok found '1169.3632465', expected '1169.3632465', error '0.0000000'

Test #21:

score: 0
Accepted
time: 64ms
memory: 3944kb

input:

40 2 695
330 272 415 276
218 0 221 2110
48 0 51 416
281 0 284 2110
381 112 385 167
339 195 438 199
133 0 138 416
302 29 306 182
48 703 51 2110
350 328 441 332
70 0 73 416
38 1819 42 1956
425 263 429 326
79 417 82 702
168 0 171 2110
56 417 59 702
34 417 37 702
372 283 376 320
93 703 96 2109
119 417 1...

output:

1169.3632464733

result:

ok found '1169.3632465', expected '1169.3632465', error '0.0000000'

Test #22:

score: 0
Accepted
time: 649ms
memory: 3992kb

input:

40 40 695
119 417 124 702
362 181 428 185
93 703 96 2109
420 107 424 172
335 87 450 91
93 0 96 416
425 263 429 326
328 50 332 177
330 272 415 276
191 0 194 2109
159 0 161 2109
231 0 234 2110
281 0 284 2110
350 328 441 332
133 703 138 2110
70 0 73 416
48 703 51 2110
70 703 73 2110
354 103 358 171
79 ...

output:

572.2601811827

result:

ok found '572.2601812', expected '572.2601812', error '0.0000000'

Test #23:

score: 0
Accepted
time: 473ms
memory: 3904kb

input:

40 39 695
350 328 441 332
381 112 385 167
330 272 415 276
17 1929 21 2024
281 0 284 824
438 96 442 190
27 1732 31 1869
108 480 112 765
213 1142 215 1966
315 82 319 189
38 1819 42 1956
182 63 190 479
425 263 429 326
420 107 424 172
335 87 450 91
354 103 358 171
272 1142 275 1966
245 1142 248 1966
163...

output:

597.0447927697

result:

ok found '597.0447928', expected '597.0447928', error '0.0000000'

Test #24:

score: 0
Accepted
time: 430ms
memory: 3972kb

input:

36 39 695
222 1142 225 1966
95 766 100 887
372 283 376 320
76 480 80 765
65 766 69 887
127 766 132 887
127 63 132 479
108 480 112 765
272 1142 275 1966
302 29 306 182
339 195 438 199
163 480 170 765
328 50 332 177
335 87 450 91
314 40 364 44
315 82 319 189
65 63 69 479
362 181 428 185
354 103 358 17...

output:

565.7225691550

result:

ok found '565.7225692', expected '565.7225692', error '0.0000000'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

0 0 1
-1000000 -1000000 1000000 1000000

output:

2828427.1247461899

result:

ok found '2828427.1247462', expected '2828427.1247462', error '0.0000000'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3936kb

input:

0 1 1000000
-1000000 0
-1000000 -1000000 1000000 1000000

output:

2236067.9774997896

result:

ok found '2236067.9774998', expected '2236067.9774998', error '0.0000000'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

0 3 1000000
-1000000 0
0 0
1000000 0
-1000000 -1000000 1000000 1000000

output:

1000000.0000000000

result:

ok found '1000000.0000000', expected '1000000.0000000', error '0.0000000'

Test #28:

score: 0
Accepted
time: 75ms
memory: 4060kb

input:

40 0 1
0 0 1 1
3 3 5 5
7 7 10 10
12 12 16 16
18 18 23 23
25 25 31 31
33 33 40 40
42 42 50 50
52 52 61 61
63 63 73 73
75 75 86 86
88 88 100 100
102 102 115 115
117 117 131 131
133 133 148 148
150 150 166 166
168 168 185 185
187 187 205 205
207 207 226 226
228 228 248 248
250 250 271 271
273 273 295 2...

output:

1417.1152357210

result:

ok found '1417.1152357', expected '1417.1152357', error '0.0000000'

Test #29:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

1 1 10
-9999 9 9999 10
0 1
0 0 -514 114

output:

521.1442606489

result:

ok found '521.1442606', expected '521.1442606', error '0.0000000'

Test #30:

score: 0
Accepted
time: 99ms
memory: 3988kb

input:

40 40 236251
412194 -1000000 494010 999998
793212 -999997 946977 999999
-999996 59339 412189 372008
946980 -417193 999997 530760
-637952 372011 -240392 1000000
494012 -990772 793211 447398
-835919 372012 -835494 999999
995573 530764 996974 999999
946982 -923137 1000000 -685959
-830201 372012 -767067...

output:

1037835.4105943321

result:

ok found '1037835.4105943', expected '1037835.4105943', error '0.0000000'

Test #31:

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

input:

40 40 823255
-999996 -424257 999997 890902
-701403 890907 593072 999999
103986 -999996 961289 -424260
-892798 -999997 -103419 -424261
979588 -1000000 982885 -424259
-999998 941169 -701408 972409
982890 -821635 999998 -710431
983157 -710427 994988 -424260
-993286 890903 -926909 941168
-997905 890905 ...

output:

18129.5786216889

result:

ok found '18129.5786217', expected '18129.5786217', error '0.0000000'

Test #32:

score: 0
Accepted
time: 87ms
memory: 3932kb

input:

40 40 133149
-38646 -1000000 67129 999996
67132 -450601 999999 742793
-999998 -452104 -38648 98902
-999997 -891809 -38647 -672811
743905 742795 831461 999999
-908399 -672809 -811612 -452109
849076 742794 902046 1000000
-1000000 -987809 -38648 -964743
-939560 -964739 -214645 -891810
832084 742797 840...

output:

77873.1108200736

result:

ok found '77873.1108201', expected '77873.1108201', error '0.0000000'

Test #33:

score: 0
Accepted
time: 157ms
memory: 3976kb

input:

40 40 211024
-389763 -999998 -57751 999998
-57750 -583072 999999 82492
-999999 -753366 -389765 400270
-862071 -999999 -572573 -753369
-999996 -905974 -862074 -770413
-893143 -770412 -875825 -753368
-57750 236661 999996 940234
-875824 -760145 -862072 -755556
-57746 980367 999996 981279
-979048 -99999...

output:

2060998.7342932499

result:

ok found '2060998.7342932', expected '2060998.7342932', error '0.0000000'

Test #34:

score: 0
Accepted
time: 79ms
memory: 4000kb

input:

40 40 29820
-999997 218259 999997 712621
-999999 -944664 999996 -456513
-999999 789714 999996 883659
300485 -456509 564919 218256
-240296 -1000000 58354 -944666
564920 -391221 999996 -19150
564923 -436021 999996 -413503
635909 -19147 801349 218256
91307 -999997 773195 -944665
963768 -999998 990370 -...

output:

1385880.6059081806

result:

ok found '1385880.6059082', expected '1385880.6059082', error '0.0000000'

Test #35:

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

input:

0 0 114514
-1000000 -1000000 1000000 1000000

output:

2828427.1247461899

result:

ok found '2828427.1247462', expected '2828427.1247462', error '0.0000000'

Test #36:

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

input:

40 40 45756
-999999 -475753 999999 361656
-999998 -748472 999999 -576040
-678349 -576035 26308 -475757
-1000000 534318 999996 737818
-185046 737819 674394 999998
473244 -576037 541683 -475756
-999999 -806672 999999 -764311
-999999 792757 -185049 926972
-999997 -870623 999999 -854644
-999996 -550579 ...

output:

1719631.8277266929

result:

ok found '1719631.8277267', expected '1719631.8277267', error '0.0000000'

Test #37:

score: 0
Accepted
time: 82ms
memory: 3920kb

input:

40 40 70
-1000000 -254249 999997 19020
-999996 -866840 999999 -256579
-999997 -255301 999996 -255217
249494 -255216 489635 -254252
-604712 -255216 -554154 -254250
469823 -999996 530701 -866845
-390184 -999999 -181627 -866841
530705 -998406 999999 -884801
112509 -1000000 202561 -866845
530705 -884008...

output:

1530333.0688098588

result:

ok found '1530333.0688099', expected '1530333.0688099', error '0.0000000'

Test #38:

score: 0
Accepted
time: 126ms
memory: 3932kb

input:

40 40 20631
-999997 -817754 999998 873608
-999997 951235 1000000 952373
-487259 -999999 688351 -817758
-999997 889205 999997 904239
688353 -919854 999997 -840076
-898776 -999996 -624547 -817755
-884850 873610 -434173 889200
-999997 959091 1000000 976787
-999998 911874 1000000 949697
-999998 949834 9...

output:

177843.3547299893

result:

ok found '177843.3547300', expected '177843.3547300', error '0.0000000'

Test #39:

score: 0
Accepted
time: 109ms
memory: 3984kb

input:

40 40 31907
-850278 -1000000 612141 999999
-960515 -999999 -911220 999998
628653 -999997 638302 999998
-909111 -999997 -865622 999998
613759 -999998 627817 999999
-999998 -38140 -960520 103110
-853996 -999998 -853182 999997
-865618 -366690 -853998 229654
-1000000 157827 -960516 948969
-999997 -82365...

output:

452281.1327886365

result:

ok found '452281.1327886', expected '452281.1327886', error '0.0000000'

Test #40:

score: 0
Accepted
time: 92ms
memory: 3972kb

input:

40 40 48502
-999997 -598224 1000000 948173
-1000000 -889984 999997 -797147
685887 948175 894154 999998
894157 997512 999996 999794
-999999 962359 685882 968867
894158 999817 1000000 999948
930607 999950 935950 999996
-999996 -726239 1000000 -700460
935952 999956 999997 999975
935954 999950 999999 99...

output:

954357.4958675123

result:

ok found '954357.4958675', expected '954357.4958675', error '0.0000000'

Test #41:

score: 0
Accepted
time: 82ms
memory: 3948kb

input:

40 40 20059
-895769 -1000000 -745996 999997
-193996 -999999 584017 999996
853393 -1000000 857445 999998
584018 243868 853389 717113
598458 717114 824377 999999
857450 -105107 999997 186834
-745994 -898162 -194000 514596
-999999 -789402 -895772 704216
-984464 -999996 -927406 -789405
-976625 704218 -9...

output:

3268521.3359070281

result:

ok found '3268521.3359070', expected '3268521.3359070', error '0.0000000'

Test #42:

score: 0
Accepted
time: 138ms
memory: 3932kb

input:

40 10 164
0 25 651 29
10 165 67 178
13 66 18 131
40 104 534 126
48 184 56 801
59 583 533 656
71 136 77 475
71 734 154 742
75 491 535 541
89 786 317 797
94 360 533 450
108 166 222 269
134 292 538 311
185 549 202 574
185 668 193 764
207 328 271 347
232 229 535 252
247 559 321 579
247 721 292 732
250 1...

output:

353.7725044869

result:

ok found '353.7725045', expected '353.7725045', error '0.0000000'

Test #43:

score: 0
Accepted
time: 121ms
memory: 3912kb

input:

40 10 80
0 25 651 29
10 165 67 178
13 66 18 131
40 104 534 126
48 184 56 801
59 583 533 656
71 136 77 475
71 734 154 742
75 491 535 541
89 786 317 797
94 360 533 450
108 166 222 269
134 292 538 311
185 549 202 574
185 668 193 764
207 328 271 347
232 229 535 252
247 559 321 579
247 721 292 732
250 13...

output:

673.0635385311

result:

ok found '673.0635385', expected '673.0635385', error '0.0000000'

Test #44:

score: 0
Accepted
time: 98ms
memory: 4008kb

input:

40 10 40
0 25 651 29
10 165 67 178
13 66 18 131
40 104 534 126
48 184 56 801
59 583 533 656
71 136 77 475
71 734 154 742
75 491 535 541
89 786 317 797
94 360 533 450
108 166 222 269
134 292 538 311
185 549 202 574
185 668 193 764
207 328 271 347
232 229 535 252
247 559 321 579
247 721 292 732
250 13...

output:

818.5168123381

result:

ok found '818.5168123', expected '818.5168123', error '0.0000000'

Test #45:

score: 0
Accepted
time: 86ms
memory: 4000kb

input:

40 10 20
0 25 651 29
10 165 67 178
13 66 18 131
40 104 534 126
48 184 56 801
59 583 533 656
71 136 77 475
71 734 154 742
75 491 535 541
89 786 317 797
94 360 533 450
108 166 222 269
134 292 538 311
185 549 202 574
185 668 193 764
207 328 271 347
232 229 535 252
247 559 321 579
247 721 292 732
250 13...

output:

1009.5261420476

result:

ok found '1009.5261420', expected '1009.5261420', error '0.0000000'

Test #46:

score: 0
Accepted
time: 79ms
memory: 3996kb

input:

40 10 10
0 25 651 29
10 165 67 178
13 66 18 131
40 104 534 126
48 184 56 801
59 583 533 656
71 136 77 475
71 734 154 742
75 491 535 541
89 786 317 797
94 360 533 450
108 166 222 269
134 292 538 311
185 549 202 574
185 668 193 764
207 328 271 347
232 229 535 252
247 559 321 579
247 721 292 732
250 13...

output:

1019.5261420476

result:

ok found '1019.5261420', expected '1019.5261420', error '0.0000000'

Test #47:

score: 0
Accepted
time: 138ms
memory: 3940kb

input:

40 10 164
0 25 651 29
10 165 67 178
13 66 18 131
40 104 534 126
48 184 56 801
59 583 533 656
71 136 77 475
71 734 154 742
75 491 535 541
94 360 533 450
108 166 222 269
134 292 538 311
185 549 202 574
185 668 193 764
207 328 271 347
232 229 535 252
247 559 321 579
247 721 292 732
250 135 306 146
284 ...

output:

234.6687392422

result:

ok found '234.6687392', expected '234.6687392', error '0.0000000'

Test #48:

score: 0
Accepted
time: 140ms
memory: 3984kb

input:

40 10 164
0 25 651 29
10 165 67 178
13 66 18 131
40 104 534 126
48 184 56 801
59 583 533 656
71 136 77 475
71 734 154 742
75 491 535 541
94 360 533 450
108 166 222 269
134 292 538 311
185 549 202 574
185 668 193 764
207 328 271 347
232 229 535 252
247 559 321 579
247 721 292 732
250 135 306 146
284 ...

output:

236.8523726120

result:

ok found '236.8523726', expected '236.8523726', error '0.0000000'

Test #49:

score: 0
Accepted
time: 159ms
memory: 3976kb

input:

40 30 37
0 25 651 29
10 165 67 178
13 66 18 131
40 104 534 126
48 184 56 801
59 583 533 656
71 136 77 475
71 734 154 742
75 491 535 541
94 360 533 450
108 166 222 269
134 292 538 311
185 549 202 574
185 668 193 764
207 328 271 347
232 229 535 252
247 559 321 579
247 721 292 732
250 135 306 146
284 1...

output:

701.0568977444

result:

ok found '701.0568977', expected '701.0568977', error '0.0000000'

Test #50:

score: 0
Accepted
time: 151ms
memory: 4000kb

input:

40 37 24
0 25 651 29
10 165 67 178
13 66 18 131
40 104 534 126
48 184 56 801
59 583 533 656
71 136 77 475
71 734 154 742
75 491 535 541
94 360 533 450
108 166 222 269
134 292 538 311
185 549 202 574
185 668 193 764
207 328 271 347
232 229 535 252
247 559 321 579
247 721 292 732
250 135 306 146
284 1...

output:

827.8062174084

result:

ok found '827.8062174', expected '827.8062174', error '0.0000000'

Test #51:

score: 0
Accepted
time: 238ms
memory: 3900kb

input:

40 40 58
0 25 651 29
10 165 67 178
13 66 18 131
40 104 534 126
48 184 56 801
59 583 533 656
71 136 77 475
71 734 154 742
75 491 535 541
94 360 533 450
108 166 222 269
134 292 538 311
185 549 202 574
185 668 193 764
207 328 271 347
232 229 535 252
247 559 321 579
247 721 292 732
250 135 306 146
284 1...

output:

388.6208948783

result:

ok found '388.6208949', expected '388.6208949', error '0.0000000'

Test #52:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

0 3 1
1000 1000
-1000 1000
1000 -1000
3 3 5 5

output:

2.8284271247

result:

ok found '2.8284271', expected '2.8284271', error '0.0000000'

Test #53:

score: 0
Accepted
time: 1630ms
memory: 3948kb

input:

38 40 960000
947568 153995 947618 154003
910595 304001 910642 304017
850038 446134 850082 446157
767465 576713 767505 576743
665015 692354 665050 692390
545342 790065 545371 790106
411545 867312 411566 867358
267089 922097 267103 922145
115715 953001 115721 953050
-38657 959221 -38655 959271
-192035...

output:

1868299.8455347694

result:

ok found '1868299.8455348', expected '1868299.8455348', error '0.0000000'

Test #54:

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

input:

1 1 10
-10 9 10 999
0 0
0 -1 5 1000

output:

999.5526435607

result:

ok found '999.5526436', expected '999.5526436', error '0.0000000'

Test #55:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

2 1 10
-10 10 10 20
10 30 20 40
0 0
0 -1 22 35

output:

32.8879802059

result:

ok found '32.8879802', expected '32.8879802', error '0.0000000'

Test #56:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

3 0 114514
0 0 10 10
20 20 30 30
40 40 50 50
-10 -10 60 60

output:

101.2899020449

result:

ok found '101.2899020', expected '101.2899020', error '0.0000000'

Test #57:

score: 0
Accepted
time: 1ms
memory: 3876kb

input:

1 22 10
-114514 1 191981 5
-1 0
-11 0
-20 -1
-15 -8
-5 -8
4 -7
7 0
15 -6
14 -15
10 -24
0 -24
-6 -32
0 -40
10 -40
17 -33
17 -23
17 -13
17 -3
17 6
17 17
17 27
17 37
0 0 0 28

output:

9.0293863659

result:

ok found '9.0293864', expected '9.0293864', error '0.0000000'

Test #58:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

1 17 10
-114514 1 191981 5
-1 0
-5 -8
4 -7
15 -6
14 -15
0 -24
-6 -32
0 -40
10 -40
17 -33
17 -23
17 -13
17 -3
17 6
17 17
17 27
17 37
0 0 0 28

output:

10.0747473831

result:

ok found '10.0747474', expected '10.0747474', error '0.0000000'

Test #59:

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

input:

38 40 960020
947568 153995 947618 154003
910595 304001 910642 304017
850038 446134 850082 446157
767465 576713 767505 576743
665015 692354 665050 692390
545342 790065 545371 790106
411545 867312 411566 867358
267089 922097 267103 922145
115715 953001 115721 953050
-38657 959221 -38655 959271
-192035...

output:

1868365.4054618336

result:

ok found '1868365.4054618', expected '1868365.4054618', error '0.0000000'

Test #60:

score: 0
Accepted
time: 2831ms
memory: 4008kb

input:

38 40 960030
947568 153995 947618 154003
910595 304001 910642 304017
850038 446134 850082 446157
767465 576713 767505 576743
665015 692354 665050 692390
545342 790065 545371 790106
411545 867312 411566 867358
267089 922097 267103 922145
115715 953001 115721 953050
-38657 959221 -38655 959271
-192035...

output:

1119872.0000260007

result:

ok found '1119872.0000260', expected '1119872.0000260', error '0.0000000'