QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#387893#1818. Apple Orchardcrimson231AC ✓4680ms4792kbC++2012.4kb2024-04-12 23:10:222024-04-12 23:10:23

Judging History

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

  • [2024-04-12 23:10:23]
  • 评测
  • 测评结果:AC
  • 用时:4680ms
  • 内存:4792kb
  • [2024-04-12 23:10:22]
  • 提交

answer

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <vector>
#include <deque>
typedef long long ll;
//typedef long double ld;
typedef double ld;
const ld INF = 1e17;
const ld TOL = 1e-10;
const ld PI = acos(-1);
const int LEN = 3e3 + 5;
int N, M, T, Q;
bool V[LEN];
bool zero(const ld& x) { return std::abs(x) < TOL; }
int sign(const ld& x) { return x < -TOL ? -1 : x > TOL; }

///=========================================================///
//half plane intersection - refer to bulijiojiodibuliduo
//O(N^2logN + 6QN) power-diagram query
///=========================================================///

struct Pos {
	ld x, y;
	Pos(ld X = 0, ld Y = 0) : x(X), y(Y) {}
	bool operator == (const Pos& p) const { return zero(x - p.x) && zero(y - p.y); }
	bool operator != (const Pos& p) const { return !zero(x - p.x) || !zero(y - p.y); }
	bool operator < (const Pos& p) const { return zero(x - p.x) ? y < p.y : x < p.x; }
	Pos operator + (const Pos& p) const { return { x + p.x, y + p.y }; }
	Pos operator - (const Pos& p) const { return { x - p.x, y - p.y }; }
	Pos operator * (const ld& scalar) const { return { x * scalar, y * scalar }; }
	Pos operator / (const ld& scalar) const { return { x / scalar, y / scalar }; }
	ld operator * (const Pos& p) const { return { x * p.x + y * p.y }; }
	ld operator / (const Pos& p) const { return { x * p.y - y * p.x }; }
	Pos operator ~ () const { return { -y, x }; }
	ld operator ! () const { return x * y; }
	Pos& operator += (const Pos& p) { x += p.x; y += p.y; return *this; }
	Pos& operator -= (const Pos& p) { x -= p.x; y -= p.y; return *this; }
	Pos& operator *= (const ld& scale) { x *= scale; y *= scale; return *this; }
	Pos& operator /= (const ld& scale) { x /= scale; y /= scale; return *this; }
	ld Euc() const { return x * x + y * y; }
	ld mag() const { return sqrt(Euc()); }
	ld ang() const { return atan2(y, x); }
	Pos unit() const { return *this / mag(); }
	int quad() const { return sign(y) == 1 || (sign(y) == 0 && sign(x) >= 0); }
	Pos rot(ld the) { return { x * cos(the) - y * sin(the),x * sin(the) + y * cos(the) }; }
	//friend bool cmpq(const Pos& a, const Pos& b) {
	//	if (a.quad() != b.quad()) return a.quad() < b.quad();
	//	else return a / b > 0;
	//}
	friend bool cmpq(const Pos& a, const Pos& b) { return (a.quad() != b.quad()) ? a.quad() < b.quad() : a / b > 0; }
	friend std::istream& operator >> (std::istream& is, Pos& p) { is >> p.x >> p.y; return is; }
	friend std::ostream& operator << (std::ostream& os, const Pos& p) { os << p.x << " " << p.y; return os; }
}; const Pos O = { 0, 0 };
typedef std::vector<Pos> Polygon;
struct Vec {
	ld vy, vx;
	Vec(ld Y = 0, ld X = 0) : vy(Y), vx(X) {}
	bool operator == (const Vec& v) const { return (zero(vy - v.vy) && zero(vx - v.vx)); }
	bool operator < (const Vec& v) const { return zero(vy - v.vy) ? vx < v.vx : vy < v.vy; }
	ld operator * (const Vec& v) const { return vy * v.vy + vx * v.vx; }
	ld operator / (const Vec& v) const { return vy * v.vx - vx * v.vy; }
	Vec operator ~ () const { return { -vx, vy }; }
	Vec& operator *= (const ld& scalar) { vy *= scalar; vx *= scalar; return *this; }
	Vec& operator /= (const ld& scalar) { vy /= scalar; vx /= scalar; return *this; }
	ld mag() const { return hypot(vy, vx); }
}; const Vec Zero = { 0, 0 };
struct Line {//ax + by = c
	Vec s;
	ld c;
	Line(Vec V = Vec(0, 0), ld C = 0) : s(V), c(C) {}
	bool operator < (const Line& l) const {
		bool f1 = Zero < s;
		bool f2 = Zero < l.s;
		if (f1 != f2) return f1;
		ld CCW = s / l.s;
		return zero(CCW) ? c * hypot(l.s.vy, l.s.vx) < l.c * hypot(s.vy, s.vx) : CCW > 0;
	}
	ld operator * (const Line& l) const { return s * l.s; }
	ld operator / (const Line& l) const { return s / l.s; }
	Line operator + (const ld& scalar) const { return Line(s, c + hypot(s.vy, s.vx) * scalar); }
	Line operator - (const ld& scalar) const { return Line(s, c - hypot(s.vy, s.vx) * scalar); }
	Line operator * (const ld& scalar) const { return Line({ s.vy * scalar, s.vx * scalar }, c * scalar); }
	Line& operator += (const ld& scalar) { c += hypot(s.vy, s.vx) * scalar; return *this; }
	Line& operator -= (const ld& scalar) { c -= hypot(s.vy, s.vx) * scalar; return *this; }
	Line& operator *= (const ld& scalar) { s *= scalar, c *= scalar; return *this; }
	ld dist(const Pos& p) const { return s.vy * p.x + s.vx * p.y; }
	ld above(const Pos& p) const { return s.vy * p.x + s.vx * p.y - c; }
	ld mag() const { return s.mag(); }
	friend std::ostream& operator << (std::ostream& os, const Line& l) { os << l.s.vy << " " << l.s.vx << " " << l.c; return os; }
};
struct Linear {//ps[0] -> ps[1] :: refer to bulijiojiodibuliduo
	Pos ps[2];
	Pos dir_;
	Pos& operator[](int i) { return ps[i]; }
	Pos dir() const { return dir_; }
	Linear(Pos a = Pos(0, 0), Pos b = Pos(0, 0)) {
		ps[0] = a;
		ps[1] = b;
		dir_ = (ps[1] - ps[0]).unit();
	}
	bool include(const Pos& p) const { return sign(dir_ / (p - ps[0])) > 0; }
	Linear push() const {//push eps outward
		const double eps = 1e-8;
		Pos delta = ~(ps[1] - ps[0]).unit() * eps;
		return Linear(ps[0] + delta, ps[1] + delta);
	}
	Linear operator + (const double eps) const {//push eps outward
		Pos delta = ~(ps[1] - ps[0]).unit() * eps;
		return Linear(ps[0] + delta, ps[1] + delta);
	}
	Linear operator - (const double eps) const {//pull eps inward
		Pos delta = ~(ps[1] - ps[0]).unit() * eps;
		return Linear(ps[0] - delta, ps[1] - delta);
	}
	friend bool parallel(const Linear& l0, const Linear& l1) { return zero(l0.dir() / l1.dir()); }
	friend bool same_dir(const Linear& l0, const Linear& l1) { return parallel(l0, l1) && l0.dir() * l1.dir() > 0; }
	bool operator < (const Linear& l0) const {
		if (same_dir(*this, l0)) return l0.include(ps[0]);
		else return cmpq(this->dir(), l0.dir());
	}
};
ld cross(const Pos& d1, const Pos& d2, const Pos& d3) { return (d2 - d1) / (d3 - d2); }
int ccw(const Pos& d1, const Pos& d2, const Pos& d3) {
	ld ret = cross(d1, d2, d3);
	return sign(ret);
}
ld dot(const Pos& d1, const Pos& d2, const Pos& d3) { return (d2 - d1) * (d3 - d2); }
ld dot(const Pos& d1, const Pos& d2, const Pos& d3, const Pos& d4) { return (d2 - d1) * (d4 - d3); }
ld dist(const Pos& d1, const Pos& d2, const Pos& t) {
	return cross(d1, d2, t) / (d1 - d2).mag();
}
Pos intersection(const Pos& p1, const Pos& p2, const Pos& q1, const Pos& q2) {
	ld a1 = cross(q1, q2, p1), a2 = -cross(q1, q2, p2);
	return (p1 * a2 + p2 * a1) / (a1 + a2);
}
Pos intersection(Linear& l1, Linear& l2) { return intersection(l1[0], l1[1], l2[0], l2[1]); }
ld rad(const Pos& p1, const Pos& p2) { return atan2l(p1 / p2, p1 * p2); }
Polygon convex_cut(const std::vector<Pos>& ps, const Pos& b1, const Pos& b2) {
	std::vector<Pos> qs;
	int n = ps.size();
	for (int i = 0; i < n; i++) {
		Pos p1 = ps[i], p2 = ps[(i + 1) % n];
		int d1 = ccw(b1, b2, p1), d2 = ccw(b1, b2, p2);
		if (d1 >= 0) qs.push_back(p1);
		if (d1 * d2 < 0) qs.push_back(intersection(p1, p2, b1, b2));
	}
	return qs;
}
Polygon sutherland_hodgman(const std::vector<Pos>& C, const std::vector<Pos>& clip) {
	int sz = clip.size();
	std::vector<Pos> ret = C;
	for (int i = 0; i < sz; i++) {
		Pos b1 = clip[i], b2 = clip[(i + 1) % sz];
		ret = convex_cut(ret, b1, b2);
	}
	return ret;
}
std::vector<Pos> circle_line_intersection(const Pos& o, const ld& r, const Pos& p1, const Pos& p2) {
	ld d = dist(p1, p2, o);
	if (std::abs(d) > r) return {};
	Pos vec = p2 - p1;
	Pos m = intersection(p1, p2, o, o + ~vec);
	ld distance = vec.mag();
	ld ratio = sqrt(r * r - d * d);
	Pos m1 = m - vec * ratio / distance;
	Pos m2 = m + vec * ratio / distance;
	if (dot(p1, p2, m1, m2) < 0) std::swap(m1, m2);
	return { m1, m2 };//p1->p2
}
std::vector<Pos> half_plane_intersection(std::vector<Linear>& HP) {//refer to bulijiojiodibuliduo
	auto check = [&](Linear& u, Linear& v, Linear& w) -> bool {
		return w.include(intersection(u, v));
		};
	std::sort(HP.begin(), HP.end());
	std::deque<Linear> dq;
	int sz = HP.size();
	for (int i = 0; i < sz; ++i) {
		if (i && same_dir(HP[i], HP[(i - 1) % sz])) continue;
		while (dq.size() > 1 && !check(dq[dq.size() - 2], dq[dq.size() - 1], HP[i])) dq.pop_back();
		while (dq.size() > 1 && !check(dq[1], dq[0], HP[i])) dq.pop_front();
		dq.push_back(HP[i]);
	}
	while (dq.size() > 2 && !check(dq[dq.size() - 2], dq[dq.size() - 1], dq[0])) dq.pop_back();
	while (dq.size() > 2 && !check(dq[1], dq[0], dq[dq.size() - 1])) dq.pop_front();
	sz = dq.size();
	if (sz < 3) return {};
	std::vector<Pos> HPI;
	for (int i = 0; i < sz; ++i) HPI.push_back(intersection(dq[i], dq[(i + 1) % sz]));
	return HPI;
}
struct Circle {
	Pos c;
	int r;
	Circle(Pos C = Pos(0, 0), int R = 0) : c(C), r(R) {}
	bool operator == (const Circle& C) const { return c == C.c && std::abs(r - C.r) < TOL; }
	bool operator != (const Circle& C) const { return !(*this == C); }
	bool operator < (const Circle& q) const {
		ld dist = (c - q.c).mag();
		return r < q.r && dist + r < q.r + TOL;
	}
	bool operator > (const Pos& p) const { return r > (c - p).mag(); }
	bool operator >= (const Pos& p) const { return r + TOL > (c - p).mag(); }
	bool operator < (const Pos& p) const { return r < (c - p).mag(); }
	Circle operator + (const Circle& C) const { return { c + C.c, r + C.r }; }
	Circle operator - (const Circle& C) const { return { c - C.c, r - C.r }; }
	ld H(const ld& th) const { return sin(th) * c.x + cos(th) * c.y + r; }//coord trans | check right
	ld A() const { return 1. * r * r * PI; }
	friend std::istream& operator >> (std::istream& is, Circle& c) { is >> c.c >> c.r; return is; }
	friend std::ostream& operator << (std::ostream& os, const Circle& c) { os << c.c << " " << c.r; return os; }
} INVAL = { { 0, 0 }, -1 };
bool cmpr(const Circle& p, const Circle& q) { return p.r > q.r; }//sort descending order
std::vector<Pos> pd[LEN];//power diagram (Laguerre-Voronoi diagram)
std::vector<Circle> disks;
ld circle_cut(const Circle& c, const Pos& p1, const Pos& p2) {
	Pos v1 = p1 - c.c, v2 = p2 - c.c;
	ld r = c.r;
	std::vector<Pos> inx = circle_line_intersection(O, r, v1, v2);
	if (inx.empty()) return r * r * rad(v1, v2) * .5;
	Pos m1 = inx[0], m2 = inx[1];
	bool d1 = dot(m1, v1, m2) > -TOL, d2 = dot(m1, v2, m2) > -TOL;
	if (d1 && d2) return (v1 / v2) * .5;
	else if (d1) return (v1 / m2 + r * r * rad(m2, v2)) * .5;
	else if (d2) return (r * r * rad(v1, m1) + m1 / v2) * .5;
	else if (dot(v1, m1, v2) > 0 && dot(v1, m2, v2) > 0)
		return (r * r * (rad(v1, m1) + rad(m2, v2)) + m1 / m2) * .5;
	else return (r * r * rad(v1, v2)) * .5;
}
void query() {
	ll x, y, w, h;
	std::vector<Pos> box;
	std::cin >> x >> y >> w >> h;
	box = { Pos(x, y), Pos(x + w, y), Pos(x + w, y + h), Pos(x, y + h) };
	ld ret = 0;
	for (int i = 0; i < N; i++) {
		if (pd[i].empty()) continue;
		std::vector<Pos> rem = sutherland_hodgman(pd[i], box);
		int sz = rem.size();
		if (sz < 3) continue;
		for (int j = 0; j < sz; j++)
			ret += circle_cut(disks[i], rem[j], rem[(j + 1) % sz]);
	}
	std::cout << ret * 100 / w / h << "\n";
	return;
}
void solve() {
	std::cin.tie(0)->sync_with_stdio(0);
	std::cout.tie(0);
	std::cout << std::fixed;
	std::cout.precision(15);
	std::cin >> N >> Q;
	std::vector<Circle> tmp(N);
	for (Circle& c : tmp) std::cin >> c;
	memset(V, 0, sizeof V);
	for (int i = 0; i < N; i++) {//remove
		if (V[i]) continue;
		for (int j = 0; j < N; j++) {
			if (i < j && tmp[i] == tmp[j]) V[i] = 1;
			if (tmp[i] < tmp[j]) V[i] = 1;
			if (tmp[j] < tmp[i]) V[j] = 1;
		}
	}
	for (int i = 0; i < N; i++) if (!V[i]) disks.push_back(tmp[i]);
	N = disks.size();
	int bnd = 3e6;
	for (int i = 0; i < N; i++) {//compose power diagram
		std::vector<Linear> HP;
		HP.push_back(Linear(Pos(bnd, bnd), Pos(-bnd, bnd)));
		HP.push_back(Linear(Pos(-bnd, bnd), Pos(-bnd, -bnd)));
		HP.push_back(Linear(Pos(-bnd, -bnd), Pos(bnd, -bnd)));
		HP.push_back(Linear(Pos(bnd, -bnd), Pos(bnd, bnd)));
		for (int j = 0; j < N; j++) {
			if (i == j) continue;
			Pos& ca = disks[i].c, cb = disks[j].c;
			ll ra = disks[i].r, rb = disks[j].r;
			Pos vec = cb - ca;//vec a -> b
			ld distance = vec.mag();
			ld X = (ra * ra - rb * rb + vec.Euc()) / (2 * distance);
			Pos m = ca + vec * X / distance;
			HP.push_back(Linear(m, m + ~vec));
		}
		pd[i] = half_plane_intersection(HP);
	}
	while (Q--) query();
	return;
}
int main() { solve(); return 0; }//NAC 2021 B Apple Orchard
//half plane intersection - refer to bulijiojiodibuliduo

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 2
0 0 3
2 1 4
0 0 3 3
-3 -3 6 6

output:

100.000000000000000
89.536784729170037

result:

ok 2 numbers

Test #2:

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

input:

4 3
-1 -1 3
1 -1 3
-1 1 3
1 1 3
-4 -4 8 8
-1 -4 2 8
-3 -1 12 3

output:

87.222142377564509
98.586991372916088
57.862330457638706

result:

ok 3 numbers

Test #3:

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

input:

1000 1
-651497 -620928 2827
-659248 -612693 2827
-666895 -604360 2827
-674437 -595932 2827
-681872 -587410 2827
-689200 -578795 2827
-696418 -570089 2827
-703527 -561293 2827
-710525 -552408 2827
-717410 -543436 2827
-724183 -534378 2827
-730840 -525236 2827
-737383 -516010 2827
-743809 -506704 2827...

output:

99.999999985448085

result:

ok found '100.00000', expected '100.00000', error '0.00000'

Test #4:

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

input:

1 1
-5 -2 2
-6 -9 3 10

output:

33.698770723805531

result:

ok found '33.69877', expected '33.69877', error '0.00000'

Test #5:

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

input:

9 1
-408263 436346 665941
43802 787157 1
462222 854102 832897
-640110 -626882 527229
684514 -860698 828055
986302 -384366 776389
-341940 -634506 278431
108949 247194 890223
898151 -809302 973099
161501 -800190 639733 841809

output:

100.000000000000000

result:

ok found '100.00000', expected '100.00000', error '0.00000'

Test #6:

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

input:

1 1
-8 31 15
1 19 7 24

output:

59.905609553787343

result:

ok found '59.90561', expected '59.90561', error '0.00000'

Test #7:

score: 0
Accepted
time: 2984ms
memory: 4692kb

input:

2979 3000
-962850 -987009 20057
-923550 -987009 19977
-884250 -987009 20186
-844950 -987009 19893
-805650 -987009 19980
-766350 -987009 20114
-727050 -987009 19899
-687750 -987009 20043
-648450 -987009 20001
-609150 -987009 20212
-569850 -987009 20077
-530550 -987009 20017
-491250 -987009 20194
-451...

output:

93.021609844988120
93.607871596832808
93.111660819671187
93.325425375675096
93.419875221814095
93.521825456083050
93.464333078617514
93.449692062018585
93.657457001560076
93.556913412915236
93.482668652401642
93.187754944990331
93.576516801538489
93.691177976335283
93.071841383863898
93.463321853831...

result:

ok 3000 numbers

Test #8:

score: 0
Accepted
time: 2821ms
memory: 4792kb

input:

2979 3000
-962850 -987009 19342
-923550 -987009 19297
-884250 -987009 19338
-844950 -987009 19723
-805650 -987009 19345
-766350 -987009 19878
-727050 -987009 19859
-687750 -987009 19764
-648450 -987009 20106
-609150 -987009 19239
-569850 -987009 19151
-530550 -987009 19062
-491250 -987009 19614
-451...

output:

90.478025829619810
90.399453795254928
91.232174107653364
90.392155747382958
90.765026917978290
89.625685171019157
90.819288042336325
90.245626001415488
92.015560528001870
90.661507159571499
90.614890647014747
90.580421739373065
90.044047082376196
90.494795033117313
90.354363023156509
90.689061445196...

result:

ok 3000 numbers

Test #9:

score: 0
Accepted
time: 2720ms
memory: 4720kb

input:

2979 3000
-962850 -987009 19296
-923550 -987009 19243
-884250 -987009 19122
-844950 -987009 19249
-805650 -987009 19300
-766350 -987009 19106
-727050 -987009 19127
-687750 -987009 19304
-648450 -987009 19311
-609150 -987009 19182
-569850 -987009 19262
-530550 -987009 19208
-491250 -987009 19443
-451...

output:

88.070758451396614
87.086117007928578
84.802135769960543
84.741228329895819
87.782345752169149
86.174792910069925
87.008434932946940
87.284133095695481
87.536428531939364
87.388293427153471
87.004378895948847
87.250887296999551
87.573404378878308
87.278466126611761
87.509704798235504
87.662082490940...

result:

ok 3000 numbers

Test #10:

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

input:

1 4
0 0 10
-9 -9 18 18
-1 -10 2 20
-10 -1 20 2
-1000 -1 2000 2

output:

89.712624261709450
99.833082436110871
99.833082436110871
0.998330824361109

result:

ok 4 numbers

Test #11:

score: 0
Accepted
time: 2ms
memory: 3884kb

input:

2 756
20 20 2
23 19 1
17 17 1 1
17 17 1 2
17 17 1 3
17 17 1 4
17 17 1 5
17 17 1 6
17 17 2 1
17 17 2 2
17 17 2 3
17 17 2 4
17 17 2 5
17 17 2 6
17 17 3 1
17 17 3 2
17 17 3 3
17 17 3 4
17 17 3 5
17 17 3 6
17 17 4 1
17 17 4 2
17 17 4 3
17 17 4 4
17 17 4 5
17 17 4 6
17 17 5 1
17 17 5 2
17 17 5 3
17 17 5 ...

output:

0.000000000000000
0.000000000000006
0.000000000000000
-0.000000000000011
-0.000000000000009
-0.000000000000007
-0.000000000000003
7.878668590693011
20.472828310145946
26.769908169872416
24.567393972175136
20.472828310145946
-0.000000000000002
20.472828310145946
34.906585039886593
42.123463404756912
...

result:

ok 756 numbers

Test #12:

score: 0
Accepted
time: 707ms
memory: 4204kb

input:

1000 1000
-250 165 300
-250 -165 300
-249 167 300
-249 -167 300
-248 168 300
-248 -168 300
-247 170 300
-247 -170 300
-246 171 300
-246 -171 300
-245 173 300
-245 -173 300
-244 174 300
-244 -174 300
-243 175 300
-243 -175 300
-242 177 300
-242 -177 300
-241 178 300
-241 -178 300
-240 180 300
-240 -1...

output:

84.153112849040156
84.341382669164872
84.499161625952695
84.636548834211766
84.756359957323724
84.860641899992743
84.949876014474910
85.025232267891127
85.087461465990884
85.136489904303602
85.172723973987615
85.196888133234921
85.209029740050340
85.209029740050369
85.196888133234935
85.172723973987...

result:

ok 1000 numbers

Test #13:

score: 0
Accepted
time: 4200ms
memory: 4588kb

input:

3000 3000
-1000000 0 666
-999333 0 665
-998666 0 664
-997999 0 663
-997332 0 662
-996665 0 661
-995998 0 660
-995331 0 659
-994664 0 658
-993997 0 657
-993331 0 656
-992664 0 655
-991997 0 654
-991330 0 653
-990663 0 652
-989996 0 651
-989329 0 650
-988662 0 649
-987995 0 648
-987329 0 647
-986662 0...

output:

66.271619047871113
66.271585319450125
66.271551590961082
66.271517862405474
66.271484133781868
66.271450405142090
66.271416676383865
66.271382947557939
66.271349218664440
66.271315489703994
66.271281760675635
66.271248031580072
66.271214302468067
66.271180573237416
66.271146843939732
66.271113114573...

result:

ok 3000 numbers

Test #14:

score: 0
Accepted
time: 4398ms
memory: 4508kb

input:

3000 3000
-1000000 0 666
-999333 0 665
-998666 0 664
-997999 0 663
-997332 0 662
-996665 0 661
-995998 0 660
-995331 0 659
-994664 0 658
-993997 0 657
-993331 0 656
-992664 0 655
-991997 0 654
-991330 0 653
-990663 0 652
-989996 0 651
-989329 0 650
-988662 0 649
-987995 0 648
-987329 0 647
-986662 0...

output:

45.556862934632584
45.556808491703897
45.556754049117359
45.556699607098338
45.556645165872361
45.556590725664648
45.556536286701004
45.556481849206619
45.556427413407228
45.556372979528241
45.556318547794604
45.556264118433035
45.556209691667966
45.556155267726190
45.556100846832038
45.556046429212...

result:

ok 3000 numbers

Test #15:

score: 0
Accepted
time: 4433ms
memory: 4520kb

input:

3000 3000
0 -1000000 666
0 -999333 665
0 -998666 664
0 -997999 663
0 -997332 662
0 -996665 661
0 -995998 660
0 -995331 659
0 -994664 658
0 -993997 657
0 -993331 656
0 -992664 655
0 -991997 654
0 -991330 653
0 -990663 652
0 -989996 651
0 -989329 650
0 -988662 649
0 -987995 648
0 -987329 647
0 -986662...

output:

66.271619047870928
66.271585319456221
66.271551590974028
66.271517862424389
66.271484133807448
66.271450405122764
66.271416676370890
66.271382947551459
66.271349218664625
66.271315489710389
66.271281760688666
66.271248031599185
66.271214302442559
66.271180573218402
66.271146843926772
66.271113114567...

result:

ok 3000 numbers

Test #16:

score: 0
Accepted
time: 4538ms
memory: 4540kb

input:

3000 3000
0 -1000000 666
0 -999333 665
0 -998666 664
0 -997999 663
0 -997332 662
0 -996665 661
0 -995998 660
0 -995331 659
0 -994664 658
0 -993997 657
0 -993331 656
0 -992664 655
0 -991997 654
0 -991330 653
0 -990663 652
0 -989996 651
0 -989329 650
0 -988662 649
0 -987995 648
0 -987329 647
0 -986662...

output:

45.625351355872667
45.625296981169612
45.625242606358007
45.625188231437463
45.625133856408176
45.625079481270078
45.625025106023429
45.624970730667833
45.624916355203453
45.624861979630488
45.624807603948739
45.624753228158255
45.624698852258909
45.624644476250907
45.624590100134071
45.624535723908...

result:

ok 3000 numbers

Test #17:

score: 0
Accepted
time: 4680ms
memory: 4772kb

input:

3000 3000
-1000000 -1000000 1
-998665 -1000000 666
-997331 -1000000 665
-995997 -1000000 664
-994663 -1000000 663
-993328 -1000000 662
-991994 -1000000 661
-990660 -1000000 660
-989326 -1000000 659
-987991 -1000000 658
-986657 -1000000 657
-985323 -1000000 656
-983989 -1000000 655
-982655 -1000000 6...

output:

0.041122493331744
0.041124782119894
0.041124782437089
0.041123705750545
0.041122404445981
0.041121544946615
0.041122357970140
0.041124760385466
0.041126426938513
0.041125898031525
0.041124646380305
0.041123386962920
0.041122830587263
0.041124449531420
0.041126849375430
0.041127680415376
0.0411268082...

result:

ok 3000 numbers

Test #18:

score: 0
Accepted
time: 77ms
memory: 4176kb

input:

3000 3000
-746962 -594125 831471
963285 556258 512696
-44530 -282161 506650
-761350 -749041 316150
478637 895054 544219
-808446 651862 884965
-715791 816516 150184
-888338 -563074 921068
-384287 708029 534607
-233387 -619016 870637
-755239 561369 879287
-852868 878038 665773
161640 -992108 105225
54...

output:

100.000000000000000
100.000000000000043
100.000000000000142
100.000000000000043
99.999999999999972
100.000000000000028
100.000000000000014
99.999999999999957
99.999999999999886
99.999999999999972
99.999999999999972
95.465320986772781
100.000000000000043
99.999999999999829
100.000000000003510
99.9999...

result:

ok 3000 numbers

Test #19:

score: 0
Accepted
time: 641ms
memory: 4320kb

input:

3000 3000
364365 -335539 45680
331814 148548 56300
-271120 -410872 33790
368845 -129556 24185
-281842 269118 3264
401341 -26588 27097
210800 185460 30043
14959 413121 4194
50900 5027 8005
-163996 -453124 10859
365858 133812 30873
352552 -215922 51752
-446910 259545 24088
-207371 -343081 35566
160057...

output:

0.000000000000000
64.996849203147363
59.333658972223049
100.000000000000085
-0.000000000000000
23.915193317323912
99.314837077472617
61.013635769977455
0.000000000000002
17.384504116183095
40.014268000451530
1.653130300858839
0.000000000000002
0.000000000000000
47.467274405953532
0.000000000000000
0...

result:

ok 3000 numbers

Test #20:

score: 0
Accepted
time: 1400ms
memory: 4392kb

input:

3000 3000
-218277 276181 9366
-64711 339037 14999
186634 -425029 8767
-76284 -432478 11729
-5061 194018 16443
-46704 469485 27159
-287513 393511 26141
200225 195732 27020
450769 -484542 7828
-469256 404361 5171
-339695 67596 24447
121746 -185763 5915
-40165 -391818 12045
-6631 399895 20292
-49488 67...

output:

33.161098185775700
31.882793800188136
68.139952417632770
-0.000000000000000
58.048480479307308
51.588611723695443
-0.000000000000000
-0.000000000000000
95.836500136756200
0.000000000000000
-0.000000000000000
0.000000000000000
0.000000000000000
0.000000000000000
0.000000000000000
10.134358075924737
-...

result:

ok 3000 numbers

Test #21:

score: 0
Accepted
time: 4653ms
memory: 4620kb

input:

3000 3000
-272257 314630 7492
289573 229521 555
152794 129189 48
-142329 172844 2831
117362 -238159 2647
-178654 68842 525
-305984 42528 1882
-362421 75426 3660
379957 -9963 4166
-321415 -339416 5812
206963 -146966 1899
-158865 -224695 5030
-294632 -291118 1360
280467 59126 4815
-347217 -474088 5538...

output:

17.767278035502120
17.549593603059009
13.071826611744767
18.052941781054642
18.603744816428545
11.579657342114039
4.408812844974589
7.525585711264843
12.959390255353764
15.656833959615303
7.535661818537279
13.574198052745505
14.156750192180496
8.938383159961834
3.845722878540704
7.889971734949827
10...

result:

ok 3000 numbers

Test #22:

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

input:

1 1
0 0 1
-1 -1 2 2

output:

78.539816339744831

result:

ok found '78.53982', expected '78.53982', error '0.00000'

Test #23:

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

input:

4 1
899981 899946 23
899995 900049 67
900004 899904 15
900018 899918 26
899978 899983 2 1

output:

9.470559445766824

result:

ok found '9.47056', expected '9.47056', error '0.00000'

Test #24:

score: 0
Accepted
time: 2958ms
memory: 4636kb

input:

3000 3000
1 1 10095
12850 -12847 10095
4 -25696 10095
-18166 -25698 10095
-33003 -15209 10095
-40607 1294 10095
-40028 19456 10095
-32084 35799 10095
-18552 47927 10095
-1606 54487 10095
16557 55022 10095
33957 49787 10095
48969 39549 10095
60386 25414 10095
67435 8667 10095
69751 -9355 10095
67337 ...

output:

29.238199355282337
19.943552487916023
29.953054731118719
30.271289244317227
29.689545022242445
24.958080665804058
30.407730487322187
29.733377711543469
29.785451484913473
29.589096946168979
29.596210812354883
29.810508984053516
30.041625951894012
25.596187618540796
29.902990735414757
30.261364723034...

result:

ok 3000 numbers