QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#685130 | #7310. Circular Sectors | crimson231 | AC ✓ | 99ms | 8860kb | C++23 | 13.5kb | 2024-10-28 17:50:32 | 2024-10-28 17:50:34 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <vector>
typedef long long ll;
typedef 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) ? 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) { 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 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); }
int ccw(const Pos& d1, const Pos& d2, const Pos& d3) { return sign(cross(d1, d2, d3)); }
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 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 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 Pos& p) const { return sign(r - (c - p).mag()) < 0; }
bool outside(const Circle& q) const { return sign((c - q.c).Euc() - sq((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;
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; }
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;
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); }
} 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) {
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));
}
}
if (i < j) {
ld r1, r2, r3, r4;
std::vector<Seg> IS = { is1, is2 };
std::vector<Seg> JS = { js1, js2 };
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 s = t == 1 ? is1 : is2;
if (on_seg_weak(s.s, s.e, cj.c)) tmp.push_back(projection(s.s, s.e, cj.c));
if (on_seg_weak(s.s, s.e, S[j].s1.s)) tmp.push_back(projection(s.s, s.e, S[j].s1.s));
if (on_seg_weak(s.s, s.e, S[j].s2.e)) tmp.push_back(projection(s.s, s.e, S[j].s2.e));
ix1 = circle_line_intersections(s, cj, LINE);
ld ix2 = intersection(s, js1);
ld ix3 = intersection(s, 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 = s.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) {
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));
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 union_area() {
ld A = 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) A += 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) A += 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) A += S[i].s2.green(hi, a.lo), hi = a.hi;
else hi = std::max(hi, a.hi);
}
}
}
return A;
}
void query() {
for (int i = 0; i < N; i++) { std::cin >> S[i]; S[i].init(); }
init();
std::cout << union_area() << "\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 Circular Sectors
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 4436kb
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.800500000000007 1.130000000000000 106.444931438703591
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 1ms
memory: 4500kb
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.937500000000002 45.712500000000006 43.533920893527551 31.802000000000010 41.885999999999996 12.932000000000002 31.713102368390356 9.889999999999999 3.811500000000000 26.789999999999999 37.187500000000007 10.700500000000002 31.423500000000008 47.664000000000001 25.456500000000002 54.013595092918763...
result:
ok 250 numbers
Test #3:
score: 0
Accepted
time: 2ms
memory: 4504kb
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.157879726552878 33.234999999999999 47.749461461744602 82.280000000000001 38.565000000000005 57.287499999999987 16.887500000000003 30.812466324073249 18.266137364384576 43.264634755237452 42.494217510621979 26.132749175803273 26.404500000000002 30.106728114671817 48.937000000000005 23.139500000000...
result:
ok 166 numbers
Test #4:
score: 0
Accepted
time: 2ms
memory: 4392kb
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.059592091965939 71.472500000000011 72.359337599729827 126.255569920521992 53.321194904763871 59.877062378554669 47.616876770028647 66.382775434501397 26.793763102702933 32.341500000000003 139.853466960893428 81.663107773503000 102.706053155319424 81.919837964614146 30.252901352145077 88.100998126...
result:
ok 125 numbers
Test #5:
score: 0
Accepted
time: 2ms
memory: 4444kb
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.693585184955907 91.736875590339153 79.436470427630923 77.453260899735838 98.285986593755354 71.089224340747080 7.725500000000002 103.276610901060778 18.876111372247369 83.851724321134327 37.132095585543560 80.144201783696161 100.607500000000030 89.227847271325899 94.924728487345121 24.35600000000...
result:
ok 100 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 4476kb
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.462255720490276 137.080435157705892 68.280440686838574 81.674905544446716 161.394725071888985 109.854743305694640 88.851098028933578 149.663820955674510 141.260453837597538 150.828583153720501 103.530625418356806 80.042106264194871 135.587222368681921 124.154668157309558 142.296821200933607 136....
result:
ok 50 numbers
Test #7:
score: 0
Accepted
time: 3ms
memory: 4504kb
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.572472199963727 423.411657030425545 188.493590961885133 663.645597577173476 237.474510029904366 435.602263268936952 426.132393829239049 393.573805742597528 204.877572258180095 211.300974323964084 159.246000000000066 84.711314252478473 65.409000000000006 288.210429276220964 53.787500000000009 323...
result:
ok 97 numbers
Test #8:
score: 0
Accepted
time: 3ms
memory: 4480kb
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.406264363613445 8029.721602593825082 17841.160242547983216 8905.310278028087851 9364.474299758408961 11342.793063077788247 7432.277263249037787 4958.018309445384148 12178.815954973782937 12163.545508884981246 10152.091787750141521 5644.239555710109016 8047.133278497372885 10406.167543782268694...
result:
ok 50 numbers
Test #9:
score: 0
Accepted
time: 11ms
memory: 4656kb
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.884972229920095 95856.664895293375594 78262.905029265632038 76227.524853917566361 101278.184257132932544 89979.898975388772669 81706.668381387135014
result:
ok 7 numbers
Test #10:
score: 0
Accepted
time: 2ms
memory: 4508kb
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.394977238749561 4418.508499999999913 33061.953463050653227 45686.056434966187226 12072.339439476245389 5985.184023385510955 50770.001552460576931 42946.205898987405817 20200.603769154655311 36999.657973594548821 4337.215999999999440 5574.280499999998028 35395.913270822020422 24095.705148067114...
result:
ok 89 numbers
Test #11:
score: 0
Accepted
time: 7ms
memory: 4516kb
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.283167443218190 21353.722702477982239 17122.857671863144787 17218.507770068510581 20193.954959457001678 18206.933769756462425 16965.217283117555780 19853.432944954329287 18881.619820128016727 12897.384431902635697 17739.729509985430923 20560.400965029879444 21622.473383571323211 21926.10674976...
result:
ok 14 numbers
Test #12:
score: 0
Accepted
time: 15ms
memory: 4776kb
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.677629778860137 101085.301215711428085 104860.539882848359412 82685.042951206516591 87897.311215470079333
result:
ok 5 numbers
Test #13:
score: 0
Accepted
time: 49ms
memory: 6716kb
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.229840328281888
result:
ok found '60.2298403', expected '60.2298403', error '0.0000000'
Test #14:
score: 0
Accepted
time: 55ms
memory: 7260kb
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.130359286166097
result:
ok found '127.1303593', expected '127.1303593', error '0.0000000'
Test #15:
score: 0
Accepted
time: 67ms
memory: 7736kb
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.537907106410245
result:
ok found '226.5379071', expected '226.5379071', error '0.0000000'
Test #16:
score: 0
Accepted
time: 99ms
memory: 8860kb
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...
output:
1290.241987371735377
result:
ok found '1290.2419874', expected '1290.2419874', error '0.0000000'
Test #17:
score: 0
Accepted
time: 93ms
memory: 8664kb
input:
500 46 -1 28 2.976 5.503 -33 13 22 1.994 2.281 -8 -21 45 0.225 2.374 20 -16 50 1.846 4.885 -47 18 16 3.164 4.896 -50 -50 29 4.952 3.139 -30 -25 36 3.288 5.414 7 22 38 1.624 2.048 38 -42 36 4.738 4.037 45 -21 26 0.862 3.469 49 31 24 2.272 2.713 -20 33 49 5.034 2.956 22 -35 43 3.503 3.866 -44 -40 1 4....
output:
30725.286701907891256
result:
ok found '30725.2867019', expected '30725.2867019', error '0.0000000'
Test #18:
score: 0
Accepted
time: 88ms
memory: 8684kb
input:
500 -30 -70 60 0.367 1.785 67 -49 33 4.479 4.251 49 69 23 3.739 3.621 -4 -79 78 5.223 4.472 76 -9 55 2.756 2.683 -92 68 46 4.485 1.664 -70 -99 83 2.169 2.224 -51 -44 37 5.120 2.789 77 1 14 1.546 0.104 31 1 5 4.427 3.778 95 -69 8 2.224 3.618 43 13 56 3.825 4.428 -22 -14 86 4.380 5.071 -32 -66 70 0.18...
output:
116138.459039379842579
result:
ok found '116138.4590394', expected '116138.4590394', error '0.0000000'
Test #19:
score: 0
Accepted
time: 0ms
memory: 4416kb
input:
1 -67 -57 95 5.527 5.362 5 -81 35 2 4.896 0.559 46 -93 2 2.108 2.103 -53 -83 90 3.952 4.883 -46 0 85 1.526 0.489 -59 49 72 4.560 2.778 2 23 67 64 5.290 2.804 89 27 23 0.733 5.058 5 20 62 53 4.727 5.415 24 52 62 4.999 4.205 -37 34 52 1.350 3.179 -43 76 83 0.130 5.985 -22 58 40 5.372 2.233 4 32 -96 83...
output:
24196.025000000001455 26709.166491608753859 6850.879799513089893 26614.846152865549811 11694.216934510921419 11487.743999999998778 327.184000000000310 9187.735767648826368 15880.670943644554427 27506.634468116440985 1788.125000000000000 10038.206999999998516 5846.010824241443515 22964.37432025548696...
result:
ok 167 numbers
Test #20:
score: 0
Accepted
time: 2ms
memory: 4440kb
input:
7 -47 -83 100 0.358 0.553 -71 97 98 1.499 3.915 17 -56 7 5.884 4.913 -18 20 52 3.900 3.718 8 29 60 0.002 2.098 -57 78 92 1.389 4.503 -60 45 98 5.668 4.783 7 -40 72 34 2.067 2.870 59 2 44 0.909 3.929 -83 15 62 3.224 3.054 -20 92 41 3.624 1.958 -64 44 67 1.002 3.405 70 -36 2 1.231 2.321 96 -87 10 1.92...
output:
38003.545741749680019 18615.980387945015536 30226.618185405655822 39138.651119082103833 39292.940077121878858 18460.238747751322080 23656.361897610342567 12845.720142760603267 37815.526148763521633 40040.124981319138897 43511.681965935407788 47180.773313263991440 27510.089072426359053 45552.13740957...
result:
ok 68 numbers
Test #21:
score: 0
Accepted
time: 87ms
memory: 8204kb
input:
500 4 1 1 5.923 2.552 3 5 2 0.653 3.552 1 2 3 2.725 5.745 1 -5 5 5.109 5.085 5 4 4 5.769 0.284 -3 -5 4 5.822 5.349 5 1 5 4.898 2.489 4 -3 4 3.888 5.049 3 0 4 5.361 0.398 -3 2 1 0.595 1.964 1 3 2 1.803 4.045 -2 -4 3 0.423 3.862 -2 1 2 2.705 0.690 -2 -3 3 2.682 2.185 -5 -5 2 3.279 0.115 3 -1 1 1.054 4...
output:
345.294170916385895
result:
ok found '345.2941709', expected '345.2941709', error '0.0000000'
Test #22:
score: 0
Accepted
time: 4ms
memory: 4460kb
input:
20 1 -35 10 3.746 3.231 24 52 90 3.896 3.562 -31 -61 75 3.823 2.329 29 -47 12 5.283 3.069 32 46 27 4.296 2.086 97 84 2 0.303 0.569 -1 97 5 4.166 5.644 71 -10 27 4.551 1.998 -16 -67 68 0.284 4.399 -90 -85 73 2.860 0.721 1 62 25 0.477 2.143 -46 -39 68 4.174 5.375 67 28 21 4.230 4.981 -22 -94 21 4.695 ...
output:
44998.723669597005937 26372.770547088453895 72184.119494019832928 47425.853590896993410 51623.399454197344312 33080.337986300124612 32731.071691809560434 45734.218398016433639 43352.520559914250043 57111.145591989239620 67496.696175494333147 28824.690509992236912 52331.899389117243118 42836.03087637...
result:
ok 32 numbers
Extra Test:
score: 0
Extra Test Passed