QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#684419 | #7310. Circular Sectors | crimson231 | RE | 104ms | 10472kb | C++17 | 18.8kb | 2024-10-28 13:17:41 | 2024-10-28 13:17:42 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <vector>
typedef long long ll;
typedef long double ld;
typedef std::vector<ld> Vld;
const ld INF = 1e17;
const ld TOL = 1e-13;
const ld PI = acosl(-1);
const int LEN = 505;
inline int sign(const ll& x) { return x < 0 ? -1 : !!x; }
inline int sign(const ld& x) { return x < -TOL ? -1 : x > TOL; }
inline bool zero(const ld& x) { return !sign(x); }
inline bool eq(const ld& u, const ld& v) { return zero(u - v); }
inline ll sq(ll x) { return x * x; }
inline ld norm(ld th) {
while (th < 0) th += 2 * PI;
while (sign(th - 2 * PI) >= 0) th -= 2 * PI;
return th;
}
inline ld fit(ld x, ld lo, ld hi) { return std::min(hi, std::max(lo, x)); }
#define si lo
#define theta hi
#define LINE 1
#define CIRCLE 2
#define STRONG 0
#define WEAK 1
int N;
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 Pos& p) const { return { x * p.x, y * p.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; }
Pos operator - () const { return { -x, -y }; }
Pos operator ~ () const { return { -y, x }; }
Pos rot(ld the) const { return Pos(x * cos(the) - y * sin(the), x * sin(the) + y * cos(the)); }
ld Euc() const { return x * x + y * y; }
ld mag() const { return sqrt(Euc()); }
Pos unit() const { return *this / mag(); }
ld rad() const { return norm(atan2(y, x)); }
friend ld rad(const Pos& p1, const Pos& p2) { return norm(atan2(p1 / p2, p1 * p2)); }
inline friend std::istream& operator >> (std::istream& is, Pos& p) { is >> p.x >> p.y; return is; }
inline friend std::ostream& operator << (std::ostream& os, const Pos& p) { os << p.x << " " << p.y; return os; }
};
ld cross(const Pos& d1, const Pos& d2, const Pos& d3) { return (d2 - d1) / (d3 - d2); }
ld cross(const Pos& d1, const Pos& d2, const Pos& d3, const Pos& d4) { return (d2 - d1) / (d4 - d3); }
int ccw(const Pos& d1, const Pos& d2, const Pos& d3) { return sign(cross(d1, d2, d3)); }
int ccw(const Pos& d1, const Pos& d2, const Pos& d3, const Pos& d4) { return sign(cross(d1, d2, d3, d4)); }
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); }
bool on_seg_strong(const Pos& d1, const Pos& d2, const Pos& d3) { return !ccw(d1, d2, d3) && sign(dot(d1, d3, d2)) >= 0; }
bool on_seg_weak(const Pos& d1, const Pos& d2, const Pos& d3) { return !ccw(d1, d2, d3) && sign(dot(d1, d3, d2)) > 0; }
bool collinear(const Pos& d1, const Pos& d2, const Pos& d3, const Pos& d4) { return !ccw(d1, d2, d3) && !ccw(d1, d2, d4); }
ld projection(const Pos& d1, const Pos& d2, const Pos& d3) { return dot(d1, d2, d3) / (d1 - d2).mag(); }
bool intersect(const Pos& s1, const Pos& s2, const Pos& d1, const Pos& d2) {
bool f1 = ccw(s1, s2, d1) * ccw(s2, s1, d2) > 0;
bool f2 = ccw(d1, d2, s1) * ccw(d2, d1, s2) > 0;
//return f1 && f2;
bool f3 = on_seg_strong(s1, s2, d1) ||
on_seg_strong(s1, s2, d2) ||
on_seg_strong(d1, d2, s1) ||
on_seg_strong(d1, d2, s2);
return (f1 && f2) || f3;
}
bool inside(const Pos& p0, const Pos& p1, const Pos& p2, const Pos& q, const int& f = STRONG) {
if (ccw(p0, p1, p2) < 0) return ccw(p0, p1, q) >= f || ccw(p1, p2, q) >= f;
return ccw(p0, p1, q) >= f && ccw(p1, p2, q) >= f;
}
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); }
struct Seg {
Pos s, e;
Seg(Pos S = Pos(), Pos E = Pos()) : s(S), e(E) {}
//ld green(const Pos& m, const ld& d) const { return m.y * d * (s.x - e.x); }
ld green(const ld& lo, const ld& hi) const {
ld d = hi - lo;
ld ratio = (lo + hi) * .5;
Pos m = s + (e - s) * ratio;
return m.y * d * (s.x - e.x);
}
Pos p(const ld& rt) const { return s + (e - s) * rt; }
};
ld dot(const Seg& p, const Seg& q) { return dot(p.s, p.e, q.s, q.e); }
bool collinear(const Seg& p, const Seg& q) { return collinear(p.s, p.e, q.s, q.e); }
struct Circle {
Pos c;
int r;
Circle(Pos C = Pos(), int R = 0) : c(C), r(R) {}
bool operator == (const Circle& q) const { return c == q.c && r == q.r; }
bool operator != (const Circle& q) const { return !(*this == q); }
bool operator < (const Circle& q) const { return r < q.r && sign(sq((ll)r - q.r) - (c - q.c).Euc()) >= 0; }
bool operator <= (const Circle& q) const { return r <= q.r && sign(sq((ll)r - q.r) - (c - q.c).Euc()) >= 0; }
bool operator > (const Pos& p) const { return sign(r - (c - p).mag()) > 0; }
bool operator >= (const Pos& p) const { return sign(r - (c - p).mag()) >= 0; }
bool operator < (const Pos& p) const { return sign(r - (c - p).mag()) < 0; }
bool operator <= (const Pos& p) const { return sign(r - (c - p).mag()) <= 0; }
//bool meet(const Circle& q) const { return sign(sq((ll)r - q.r) - (c - q.c).Euc()) <= 0 && sign(sq((ll)r + q.r) - (c - q.c).Euc()) >= 0; }
bool outside(const Circle& q) const { return sign((c - q.c).Euc() - sq((ll)r + q.r)) >= 0; }
//bool outside(const Circle& q) const { return sign((c - q.c).mag() - ((ll)r + q.r)) >= 0; }
ld area(const ld& lo, const ld& hi) const { return (hi - lo) * r * r * .5; }
ld rad(const Pos& p) const { return (p - c).rad(); }
ld green(const ld& lo, const ld& hi) const {
Pos s = Pos(cos(lo), sin(lo)), e = Pos(cos(hi), sin(hi));
ld fan = area(lo, hi);
Pos m = c + (s + e) * r * (ld).5;
ld tz = (cos(lo) - cos(hi)) * m.y * r;
return fan + tz - (s / e) * r * r * (ld).5;
}
Pos p(const ld& t) const { return c + Pos(r, 0).rot(t); }
inline friend std::istream& operator >> (std::istream& is, Circle& c) { is >> c.c >> c.r; return is; }
inline friend std::ostream& operator << (std::ostream& os, const Circle& c) { os << c.c << " " << c.r; return os; }
};
bool cmpcr(const Circle& p, const Circle& q) { return p.c == q.c ? p.r < q.r : p.c < q.c; }
ld intersection(const Seg& s1, const Seg& s2) {
const Pos& p1 = s1.s, p2 = s1.e, q1 = s2.s, q2 = s2.e;
ld det = (q2 - q1) / (p2 - p1);
if (zero(det)) return -1;
ld a1 = ((q2 - q1) / (q1 - p1)) / det;
ld a2 = ((p2 - p1) / (p1 - q1)) / -det;
if (0 < a1 && a1 < 1 && -TOL < a2 && a2 < 1 + TOL) return a1;
return -1;
}
Vld circle_line_intersections(const Seg& l, const Circle& q, const int& t = LINE) {
//https://math.stackexchange.com/questions/311921/get-location-of-vector-circle-intersection
Pos s = l.s, e = l.e;
Pos vec = e - s;
Pos OM = s - q.c;
ld a = vec.Euc();
ld b = vec * OM;
ld c = OM.Euc() - q.r * q.r;
ld J = b * b - a * c;
if (J < -TOL) return {};
ld det = sqrt(std::max((ld)0, J));
ld lo = (-b - det) / a;
ld hi = (-b + det) / a;
Vld ret;
if (t == LINE) {
if (0 < lo && lo < 1) ret.push_back(lo);
if (zero(det)) return ret;//remove dupl
if (0 < hi && hi < 1) ret.push_back(hi);
}
else {//circle
auto the = [&](ld rt) { return q.rad(s + (e - s) * rt); };
if (-TOL < lo && lo < 1 + TOL) ret.push_back(the(lo));
if (zero(det)) return ret;//remove dupl
if (-TOL < hi && hi < 1 + TOL) ret.push_back(the(hi));
}
return ret;
}
Vld intersection(const Circle& a, const Circle& b) {
Pos ca = a.c, cb = b.c;
Pos vec = cb - ca;
ll ra = a.r, rb = b.r;
ld distance = vec.mag();
ld rd = vec.rad();
if (vec.Euc() > sq(ra + rb) + TOL) return {};
if (vec.Euc() < sq(ra - rb) - TOL) return {};
ld X = (ra * ra - rb * rb + vec.Euc()) / (2 * distance * ra);
if (X < -1) X = -1;
if (X > 1) X = 1;
ld h = acos(X);
Vld ret = {};
ret.push_back(norm(rd - h));
if (zero(h)) return ret;//remove dupl
ret.push_back(norm(rd + h));
return ret;
}
struct Arc {
ld lo, hi;// [lo, hi] - radian range of arc, 0 ~ 2pi
Arc(ld LO = 0, ld HI = 0) : lo(LO), hi(HI) {}
bool operator < (const Arc& a) const { return zero(lo - a.lo) ? hi < a.hi : lo < a.lo; }
//ld area(const Circle& cen) const { return (hi - lo) * cen.r * cen.r; }
//ld green(const Circle& cen) const {
// Pos LO = -Pos(1, 0).rot(lo) * cen.r;
// Pos HI = Pos(1, 0).rot(hi) * cen.r;
// Pos vec = Pos(cen.c.x, cen.c.y);
// return (area(cen) + vec / (HI + LO)) * .5;
//}
//ld m() const {
// ld m_ = (lo + hi) * .5;
// if (sign(lo - hi) > 0) m_ = norm(m_ + PI);
// return m_;
//}
//Pos mid(const Circle& c) const { return c.c + Pos(c.r).rot(m()); }
inline friend std::istream& operator >> (std::istream& is, Arc& a) { is >> a.lo >> a.hi; return is; }
inline friend std::ostream& operator << (std::ostream& os, const Arc& a) { os << a.lo << " " << a.hi; return os; }
};
typedef std::vector<Arc> Arcs;
//void insert(Arcs& va, const Arc& a, const bool& rvs = 0) {
// ld l = a.lo, h = a.hi;
// if (rvs) std::swap(l, h);
// if (l > h) { va.push_back(Arc(l, 2 * PI)); va.push_back(Arc(0, h)); }
// else va.push_back(Arc(l, h));
// return;
//}
struct Sector {
Circle c;
Arc a;
Seg s1, s2;
Arcs va, r1, r2;
int val = -1;
inline friend std::istream& operator >> (std::istream& is, Sector& s) { is >> s.c >> s.a; return is; }
void init() {
a.hi = norm(a.si + a.theta);
std::swap(a.lo, a.hi);
Pos lo = c.p(a.lo);
Pos hi = c.p(a.hi);
s1 = Seg(lo, c.c); s2 = Seg(c.c, hi);
va.clear(); r1.clear(); r2.clear();
val = 1;
}
bool outer_check(const Pos& q, const int& f = STRONG) const { return inside(s2.e, c.c, s1.s, q, f); }
bool ccw() const { return sign(cross(s2.e, c.c, s1.s)); }
} S[LEN];
bool cmpc(const Sector& p, const Sector& q) { return cmpcr(p.c, q.c); }
bool inner_check(const Sector& s, const Pos& p, const int& f = STRONG) {
assert(!eq(s.c.r, (s.c.c - p).mag()));
if (s.c < p) return 0;
return !s.outer_check(p, f == STRONG ? WEAK : STRONG);
}
void init() {
std::sort(S, S + N, cmpc);
for (int i = 0; i < N; i++) {
const Arc& ai = S[i].a;
Arcs uva;
for (int j = 0; j < N; j++) {
if (i == j) continue;
const Circle& ci = S[i].c, cj = S[j].c;
if (ci.outside(cj)) continue;
const Arc& aj = S[j].a;
const Seg& is1 = S[i].s1, is2 = S[i].s2;
const Seg& js1 = S[j].s1, js2 = S[j].s2;
if (ci == cj) {
if (j < i) continue;
while (j < N && ci == S[j].c) {
S[j].val = 0;
uva.push_back(S[j].a);
if (!S[i].outer_check(js1.s, WEAK))
S[j].r1.push_back(Arc(0, 1));
if (!S[i].outer_check(js2.e, WEAK))
S[j].r2.push_back(Arc(0, 1));
if (!S[j].outer_check(is1.s, STRONG) || is1.s == js2.e)
S[i].r1.push_back(Arc(0, 1));
if (!S[j].outer_check(is2.e, STRONG) || is2.e == js1.s)
S[i].r2.push_back(Arc(0, 1));
j++;
}
j--;
if (S[i].val) {
S[i].val = 2;
uva.push_back(S[i].a);
}
continue;
}
Vld tmp = { 0, 2 * PI };
if (S[i].val) {
Vld cc = intersection(ci, cj);
Vld cs1 = circle_line_intersections(js1, ci, CIRCLE);
Vld cs2 = circle_line_intersections(js2, ci, CIRCLE);
tmp.insert(tmp.end(), cc.begin(), cc.end());
tmp.insert(tmp.end(), cs1.begin(), cs1.end());
tmp.insert(tmp.end(), cs2.begin(), cs2.end());
std::sort(tmp.begin(), tmp.end());
tmp.erase(unique(tmp.begin(), tmp.end(), eq), tmp.end());
int sz = tmp.size();
for (int k = 0; k < sz - 1; k++) {
ld l = tmp[k], h = tmp[k + 1];
ld m = (l + h) * .5;
Pos mid = ci.p(m);
if (inner_check(S[j], mid)) S[i].va.push_back(Arc(l, h));
}
}
ld r1, r2, r3, r4;
std::vector<Seg> IS = { is1, is2 };
std::vector<Seg> JS = { js1, js2 };
if (i < j) {
for (int k = 1; k <= 2; k++) {
for (int l = 1; l <= 2; l++) {
const Seg& s1 = IS[k - 1];
const Seg& s2 = JS[l - 1];
if (collinear(s1, s2)) {
r1 = projection(s1.s, s1.e, s2.s); r1 = fit(r1, 0, 1);
r2 = projection(s1.s, s1.e, s2.e); r2 = fit(r2, 0, 1);
r3 = projection(s2.s, s2.e, s1.s); r3 = fit(r3, 0, 1);
r4 = projection(s2.s, s2.e, s1.e); r4 = fit(r4, 0, 1);
if (l == 1) S[j].r1.push_back(Arc(r3, r4));
if (l == 2) S[j].r2.push_back(Arc(r3, r4));
if (dot(s1, s2) < 0) {
if (k == 1) S[i].r1.push_back(Arc(r1, r2));
if (k == 2) S[i].r2.push_back(Arc(r1, r2));
}
}
}
}
}
for (int t = 1; t <= 2; t++) {
tmp = { (ld)0, (ld)1 };
Vld ix1;
Seg s1 = t == 1 ? is1 : is2;
if (on_seg_strong(s1.s, s1.e, cj.c)) {
ld ix = projection(s1.s, s1.e, cj.c);
tmp.push_back(ix);
}
if (on_seg_strong(s1.s, s1.e, S[j].s1.s)) {
ld ix = projection(s1.s, s1.e, S[j].s1.s);
tmp.push_back(ix);
}
if (on_seg_strong(s1.s, s1.e, S[j].s2.e)) {
ld ix = projection(s1.s, s1.e, S[j].s2.e);
tmp.push_back(ix);
}
ix1 = circle_line_intersections(s1, cj, LINE);
ld ix2 = intersection(s1, js1);
ld ix3 = intersection(s1, js2);
tmp.insert(tmp.end(), ix1.begin(), ix1.end());
if (ix2 > -TOL) tmp.push_back(ix2);
if (ix3 > -TOL) tmp.push_back(ix3);
std::sort(tmp.begin(), tmp.end());
tmp.erase(unique(tmp.begin(), tmp.end(), eq), tmp.end());
int sz = tmp.size();
for (int k = 0; k < sz - 1; k++) {
ld l = tmp[k], h = tmp[k + 1];
ld m = (l + h) * .5;
Pos mid = s1.p(m);
if (t == 1 && inner_check(S[j], mid, WEAK)) S[i].r1.push_back(Arc(l, h));
if (t == 2 && inner_check(S[j], mid, WEAK)) S[i].r2.push_back(Arc(l, h));
}
}
}
if (S[i].val == 1) {
ld lo = ai.lo, hi = ai.hi;
if (lo > hi) {
S[i].va.push_back(Arc(lo, 2 * PI));
S[i].va.push_back(Arc(0, hi));
}
else S[i].va.push_back(Arc(lo, hi));
}
else if (S[i].val == 2) {
//std::cout << "FUCK::\n";
//uva.push_back(S[i].a);
Arcs va;
for (const Arc& a : uva) {
ld lo = a.lo, hi = a.hi;
if (lo < hi) {
va.push_back(Arc(hi, 2 * PI));
va.push_back(Arc(0, lo));
}
else va.push_back(Arc(hi, lo));
}
std::sort(va.begin(), va.end());
va.push_back(Arc(2 * PI, 2 * PI));
//for (const Arc& a : uva) std::cout << a.lo << " " << a.hi << " uva\n";
//for (const Arc& a : va) std::cout << a.lo << " " << a.hi << " va\n";
ld cur = 0;
for (const Arc& a : va) {
if (a.lo > cur) S[i].va.push_back(Arc(cur, a.lo)), cur = a.hi;
else cur = std::max(cur, a.hi);
}
}
std::sort(S[i].va.begin(), S[i].va.end());
S[i].va.push_back(Arc(2 * PI, 2 * PI));
std::sort(S[i].r1.begin(), S[i].r1.end());
S[i].r1.push_back(Arc(1, 1));
std::sort(S[i].r2.begin(), S[i].r2.end());
S[i].r2.push_back(Arc(1, 1));
}
return;
}
ld green() {
ld union_area = 0, hi = 0;
for (int i = 0; i < N; i++) {
if (S[i].val) {
hi = 0;
for (const Arc& a : S[i].va) {
if (a.lo > hi) union_area += S[i].c.green(hi, a.lo), hi = a.hi;
else hi = std::max(hi, a.hi);
}
}
if (!eq(S[i].s1.s.x, S[i].s1.e.x)) {
hi = 0;
for (const Arc& a : S[i].r1) {
if (a.lo > hi) union_area += S[i].s1.green(hi, a.lo), hi = a.hi;
else hi = std::max(hi, a.hi);
}
}
if (!eq(S[i].s2.s.x, S[i].s2.e.x)) {
hi = 0;
for (const Arc& a : S[i].r2) {
if (a.lo > hi) union_area += S[i].s2.green(hi, a.lo), hi = a.hi;
else hi = std::max(hi, a.hi);
}
}
}
return union_area;
}
void query() {
for (int i = 0; i < N; i++) { std::cin >> S[i]; S[i].init(); }
init();
std::cout << green() << "\n";
return;
}
void solve() {
std::cin.tie(0)->sync_with_stdio(0);
std::cout.tie(0);
std::cout << std::fixed;
std::cout.precision(15);
while (std::cin >> N) query();
return;
}
int main() { solve(); return 0; }//boj19368
/*
남은 구현 내용: 완전히 같은 원들은 병합해서 하나로 운용 가능. 한 개로 합치는 함수를 구현해야함.
2
1 1 1 0 0.5
1 1 1 0.4 6
0.162049691907653
*/
//struct Pii {
// int x, y;
// Pii(int X = 0, int Y = 0) : x(X), y(Y) {}
// bool operator == (const Pii& p) const { return x == p.x && y == p.y; }
// bool operator != (const Pii& p) const { return x != p.x || y != p.y; }
// bool operator < (const Pii& p) const { return x == p.x ? y < p.y : x < p.x; }
// bool operator <= (const Pii& p) const { return x == p.x ? y <= p.y : x <= p.x; }
// Pii operator + (const Pii& p) const { return { x + p.x, y + p.y }; }
// Pii operator - (const Pii& p) const { return { x - p.x, y - p.y }; }
// Pii operator * (const int& n) const { return { x * n, y * n }; }
// Pii operator / (const int& n) const { return { x / n, y / n }; }
// ll operator * (const Pii& p) const { return { (ll)x * p.x + (ll)y * p.y }; }
// ll operator / (const Pii& p) const { return { (ll)x * p.y - (ll)y * p.x }; }
// Pii& operator += (const Pii& p) { x += p.x; y += p.y; return *this; }
// Pii& operator -= (const Pii& p) { x -= p.x; y -= p.y; return *this; }
// Pii& operator *= (const int& scale) { x *= scale; y *= scale; return *this; }
// Pii& operator /= (const int& scale) { x /= scale; y /= scale; return *this; }
// Pii operator - () const { return { -x, -y }; }
// Pii operator ~ () const { return { -y, x }; }
// Pii operator ! () const { return { y, x }; }
// ll xy() const { return (ll)x * y; }
// inline ll Euc() const { return (ll)x * x + (ll)y * y; }
// inline ld rad() const { return norm(atan2(y, x)); }
// int Man() const { return std::abs(x) + std::abs(y); }
// ld mag() const { return hypot(x, y); }
// inline friend std::istream& operator >> (std::istream& is, Pii& p) { is >> p.x >> p.y; return is; }
// friend std::ostream& operator << (std::ostream& os, const Pii& p) { os << p.x << " " << p.y; return os; }
//};
//const Pii Oii = { 0, 0 };
//const Pii INF_PT = { (int)INF, (int)INF };
//inline ll cross(const Pii& d1, const Pii& d2, const Pii& d3) { return (d2 - d1) / (d3 - d2); }
//inline ll cross(const Pii& d1, const Pii& d2, const Pii& d3, const Pii& d4) { return (d2 - d1) / (d4 - d3); }
//inline ll dot(const Pii& d1, const Pii& d2, const Pii& d3) { return (d2 - d1) * (d3 - d2); }
//inline ll dot(const Pii& d1, const Pii& d2, const Pii& d3, const Pii& d4) { return (d2 - d1) * (d4 - d3); }
//inline int ccw(const Pii& d1, const Pii& d2, const Pii& d3) { return sign(cross(d1, d2, d3)); }
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4460kb
input:
2 -3 -5 5 0.705 0.217 -5 1 4 3.070 4.136 1 -4 -4 1 0.485 2.260 3 4 4 4 4.266 4.673 2 -4 5 0.353 5.565 -2 1 3 3.974 0.207
output:
35.800500000000002 1.130000000000000 106.444931438703586
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 4452kb
input:
2 -2 -1 5 2.250 0.555 -3 0 2 2.189 0.788 2 -5 1 5 0.432 1.643 3 5 5 4.779 2.014 2 2 0 3 4.194 2.691 4 -3 4 0.998 5.376 2 -3 1 4 5.841 2.968 -4 -3 2 4.151 4.029 2 4 -1 5 2.416 2.385 5 0 3 5.315 2.683 2 -2 0 2 3.972 1.255 2 -5 2 0.912 5.211 2 1 0 4 2.826 3.794 -2 -3 1 3.335 3.836 2 -5 4 2 2.496 2.273 ...
output:
6.937500000000000 45.712500000000002 43.533920893527542 31.802000000000002 41.886000000000001 12.932000000000000 31.713102368390358 9.890000000000000 3.811500000000001 26.790000000000000 37.187500000000003 10.700500000000001 31.423500000000000 47.664000000000004 25.456500000000000 54.013595092918765...
result:
ok 250 numbers
Test #3:
score: 0
Accepted
time: 2ms
memory: 4544kb
input:
3 1 -1 5 3.089 5.717 -2 0 2 4.806 3.257 0 -3 2 5.069 3.049 3 -2 -4 2 4.616 2.875 2 -2 4 5.798 3.097 -1 2 1 0.064 5.418 3 -1 1 2 4.105 3.883 0 5 4 1.936 4.292 2 -5 2 0.278 4.486 3 3 -5 5 3.208 4.696 -2 -4 3 3.609 0.906 -2 4 3 3.796 4.334 3 0 -1 1 4.313 0.711 2 -2 1 2.962 0.344 -4 2 5 2.524 3.043 3 -1...
output:
74.157879726552898 33.235000000000002 47.749461461744601 82.280000000000007 38.565000000000000 57.287500000000003 16.887500000000000 30.812466324073252 18.266137364384573 43.264634755237462 42.494217510621980 26.132749175803263 26.404500000000000 30.106728114671796 48.937000000000000 23.139500000000...
result:
ok 166 numbers
Test #4:
score: 0
Accepted
time: 2ms
memory: 4552kb
input:
4 4 3 4 1.727 2.114 -5 3 2 5.010 2.690 -1 1 5 4.078 2.852 1 5 5 2.974 4.884 4 3 4 1 5.626 2.021 2 -4 1 1.241 0.231 4 -4 5 0.323 5.472 -2 5 2 2.648 1.031 4 -1 -1 2 0.156 3.062 2 2 1 1.127 4.124 5 3 5 1.105 5.179 4 2 3 3.363 4.235 4 -2 -3 3 1.013 4.047 0 -5 5 1.829 4.952 -4 0 5 2.029 4.410 3 -1 4 1.40...
output:
89.059592091965938 71.472500000000000 72.359337599729830 126.255569920522027 53.321194904763863 59.877062378554663 47.616876770028658 66.382775434501409 26.793763102702918 32.341500000000001 139.853466960893419 81.663107773503014 102.706053155319418 81.919837964614147 30.252901352145075 88.100998126...
result:
ok 125 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 4508kb
input:
5 -4 -1 4 2.566 3.253 1 -1 2 3.826 4.000 1 2 5 4.113 3.814 -1 -4 2 4.386 3.959 -1 -2 1 5.785 3.937 5 4 2 4 2.417 0.945 -5 -3 3 4.946 5.172 2 -2 2 2.380 0.205 3 3 4 0.766 4.402 -2 4 5 3.442 4.263 5 0 -4 3 5.172 0.603 -4 -5 3 1.321 3.688 -5 1 4 4.363 3.784 -5 -1 4 2.943 2.791 -2 5 3 5.292 5.765 5 -5 -...
output:
79.693585184955928 91.736875590339173 79.436470427630914 77.453260899735854 98.285986593755343 71.089224340747058 7.725499999999999 103.276610901060772 18.876111372247369 83.851724321134312 37.132095585543559 80.144201783696150 100.607500000000003 89.227847271325917 94.924728487345126 24.35600000000...
result:
ok 100 numbers
Test #6:
score: 0
Accepted
time: 4ms
memory: 4456kb
input:
10 4 4 4 2.043 4.661 0 -2 3 4.728 5.010 1 5 5 0.478 2.500 1 2 4 3.314 2.904 4 -4 5 3.408 5.869 -3 1 5 0.644 2.968 2 0 4 5.532 0.421 2 -3 1 3.492 0.855 -3 -3 5 4.475 4.896 -4 -1 3 0.873 1.815 10 -2 -1 3 4.786 3.714 -4 -3 1 0.155 4.804 -1 -5 3 4.225 2.500 -4 -1 4 5.536 3.954 4 -2 4 5.516 2.204 -3 2 4 ...
output:
217.462255720490281 137.080435157705909 68.280440686838584 81.674905544446750 161.394725071889050 109.854743305694672 88.851098028933560 149.663820955674479 141.260453837597510 150.828583153720505 103.530625418356820 80.042106264194869 135.587222368681938 124.154668157309526 142.296821200933606 136....
result:
ok 50 numbers
Test #7:
score: 0
Accepted
time: 3ms
memory: 4500kb
input:
9 6 -5 6 4.848 5.374 9 4 3 2.135 4.598 8 -4 6 4.443 5.157 0 5 9 3.605 1.226 7 -4 9 1.917 4.657 6 -7 8 3.621 0.258 3 3 4 1.955 5.563 -6 -5 5 3.174 3.778 -10 9 1 5.808 1.214 10 2 0 8 5.479 1.980 -3 -1 10 2.909 0.574 -8 -10 4 1.758 4.039 2 -6 9 5.761 4.499 1 1 2 0.115 0.897 -3 7 6 0.574 4.703 -4 5 6 0....
output:
340.572472199963792 423.411657030425588 188.493590961885192 663.645597577173489 237.474510029904429 435.602263268936954 426.132393829239048 393.573805742597450 204.877572258180112 211.300974323964103 159.246000000000006 84.711314252478485 65.409000000000003 288.210429276221022 53.787499999999998 323...
result:
ok 97 numbers
Test #8:
score: 0
Accepted
time: 4ms
memory: 4484kb
input:
10 -19 46 24 2.749 0.181 25 -35 45 5.805 4.054 -19 41 38 3.066 0.881 39 -15 22 5.876 4.537 -34 23 23 2.975 5.225 -21 -27 36 5.103 1.849 -43 -27 47 1.506 5.692 8 -12 16 2.217 3.584 -39 2 48 3.455 0.978 23 15 42 2.422 2.305 10 41 -31 32 2.089 3.004 -25 22 41 4.804 4.138 -25 32 37 0.576 3.483 -35 36 32...
output:
12052.406264363611962 8029.721602593827239 17841.160242547987243 8905.310278028087484 9364.474299758411717 11342.793063077792200 7432.277263249038394 4958.018309445385099 12178.815954973787373 12163.545508884979771 10152.091787750142473 5644.239555710110096 8047.133278497372594 10406.167543782264315...
result:
ok 50 numbers
Test #9:
score: 0
Accepted
time: 23ms
memory: 5040kb
input:
93 48 -38 55 2.613 0.385 28 53 75 4.293 2.033 88 33 4 3.991 5.533 11 57 6 4.203 2.347 95 71 11 4.082 3.258 -4 39 61 0.466 4.435 -28 -36 75 1.871 5.160 15 -42 18 2.512 3.285 -68 10 25 4.824 3.391 -61 -21 75 1.593 4.869 41 -30 36 0.436 3.602 -100 94 48 4.538 1.943 -1 19 73 1.400 1.056 -43 29 42 2.508 ...
output:
90187.884972229955473 95856.664895293359336 78262.905029265650604 76227.524853917552633 101278.184257132957406 89979.898975388798547 81706.668381387143285
result:
ok 7 numbers
Test #10:
score: 0
Accepted
time: 3ms
memory: 4556kb
input:
4 -46 6 35 0.448 0.600 -38 -36 29 2.044 0.247 87 -33 87 0.139 5.721 -22 -69 56 5.013 5.314 1 -16 11 41 4.997 5.257 10 -80 -53 86 4.687 1.234 -76 -66 64 4.487 2.231 -46 3 39 5.532 4.214 -16 -94 70 1.841 2.220 -66 98 2 4.388 5.140 1 53 15 2.496 0.741 79 79 79 2.831 2.307 -16 10 92 4.938 3.805 -98 65 7...
output:
28820.394977238746799 4418.508500000000225 33061.953463050661838 45686.056434966198786 12072.339439476245501 5985.184023385509242 50770.001552460580662 42946.205898987399625 20200.603769154650337 36999.657973594572567 4337.216000000000331 5574.280500000000000 35395.913270822024852 24095.705148067117...
result:
ok 89 numbers
Test #11:
score: 0
Accepted
time: 11ms
memory: 4584kb
input:
33 -20 33 3 4.628 3.531 -43 10 4 5.952 4.299 49 -32 7 4.523 5.619 31 -15 5 4.429 1.704 50 40 14 4.025 0.773 -44 -14 31 0.113 2.654 -48 -16 2 4.571 2.209 16 14 11 3.296 3.719 34 -7 17 5.346 2.974 6 -45 22 3.532 2.678 -45 -14 33 3.100 1.706 -30 42 43 2.729 3.312 44 16 46 1.660 2.278 40 44 1 3.442 3.05...
output:
15802.283167443218704 21353.722702477988681 17122.857671863151420 17218.507770068511242 20193.954959457002793 18206.933769756461734 16965.217283117566277 19853.432944954331969 18881.619820128014256 12897.384431902636254 17739.729509985428059 20560.400965029888052 21622.473383571325074 21926.10674976...
result:
ok 14 numbers
Test #12:
score: 0
Accepted
time: 30ms
memory: 5044kb
input:
100 7 -66 7 3.504 5.074 -99 4 5 2.346 0.874 -68 93 47 4.684 5.490 89 46 87 4.250 0.385 46 79 87 2.659 5.715 -10 34 60 3.444 1.728 -82 69 83 4.298 2.078 -75 28 57 1.351 3.565 3 69 97 2.213 3.702 31 8 14 2.294 0.927 97 -23 65 1.493 1.414 55 47 45 2.466 4.113 -78 58 91 1.963 5.592 -97 49 84 4.659 1.604...
output:
96546.677629778873381 101085.301215711439916 104860.539882848342941 82685.042951206515035 87897.311215470066053
result:
ok 5 numbers
Test #13:
score: 0
Accepted
time: 85ms
memory: 8696kb
input:
500 1 -1 2 1.046 1.346 2 2 1 5.506 0.926 0 -2 2 5.468 3.385 0 -1 1 2.747 4.753 1 -2 2 1.805 5.313 2 0 2 1.543 3.123 2 2 2 1.604 0.801 0 -1 2 4.470 5.702 -1 2 2 1.725 4.320 1 1 1 3.526 5.798 2 0 2 2.157 3.678 -2 -2 2 3.575 0.905 -1 0 2 0.226 3.358 -1 0 2 0.655 0.196 -2 -2 1 4.774 0.375 -1 1 2 2.597 1...
output:
60.229840328281885
result:
ok found '60.2298403', expected '60.2298403', error '0.0000000'
Test #14:
score: 0
Accepted
time: 92ms
memory: 9592kb
input:
500 -3 -3 1 4.530 5.443 0 0 2 5.225 2.961 -2 3 3 0.553 3.603 2 3 1 3.997 3.909 3 -1 2 4.323 5.990 -3 -2 2 1.844 3.239 1 3 2 4.381 4.342 3 -3 2 5.542 4.859 1 1 3 5.812 2.058 1 0 3 4.137 5.145 -3 1 1 1.968 5.381 -3 0 1 5.792 5.585 3 -3 2 2.248 5.630 -2 -3 2 4.869 3.928 1 2 2 3.471 1.300 1 3 3 3.349 1....
output:
127.130359286166141
result:
ok found '127.1303593', expected '127.1303593', error '0.0000000'
Test #15:
score: 0
Accepted
time: 104ms
memory: 10472kb
input:
500 -2 -3 3 2.226 2.479 1 2 2 4.733 2.677 1 -1 4 1.639 0.785 0 -1 4 1.658 5.930 1 -1 2 0.839 0.766 1 4 2 5.733 3.355 1 -3 3 4.533 4.848 -3 0 4 2.815 5.893 1 -1 3 1.486 3.819 -1 4 2 3.573 2.616 -3 -1 2 1.991 2.342 -2 1 1 4.208 0.340 -4 -1 2 0.683 3.160 -1 2 4 4.469 2.477 3 -1 4 2.169 1.067 2 4 2 4.10...
output:
226.537907106410286
result:
ok found '226.5379071', expected '226.5379071', error '0.0000000'
Test #16:
score: -100
Runtime Error
input:
500 1 -4 3 0.955 4.537 -6 -8 5 2.270 2.636 0 -8 6 2.832 0.248 5 -10 5 3.043 4.276 -8 7 5 0.498 5.868 4 2 1 0.859 5.246 5 2 6 3.800 0.490 -4 9 1 5.411 3.038 -7 -5 8 3.363 4.987 10 8 3 1.132 5.824 -5 1 1 4.473 5.142 3 8 3 1.239 0.169 9 8 10 1.572 3.165 -9 -6 1 5.417 0.808 -1 9 7 3.432 2.583 -5 -5 10 2...