QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#107881#6302. MapmaspyAC ✓7ms3872kbC++2318.4kb2023-05-23 02:44:212023-05-23 02:44:24

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-23 02:44:24]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:3872kb
  • [2023-05-23 02:44:21]
  • 提交

answer

#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'000'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;

using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

#define vv(type, name, h, ...) \
  vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...)   \
  vector<vector<vector<type>>> name( \
      h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)       \
  vector<vector<vector<vector<type>>>> name( \
      a, vector<vector<vector<type>>>(       \
             b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))

// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)

#define FOR_subset(t, s) \
  for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define stoi stoll

int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }

template <typename T, typename U>
T ceil(T x, U y) {
  return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U>
T floor(T x, U y) {
  return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T, typename U>
pair<T, T> divmod(T x, U y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

template <typename T, typename U>
T SUM(const vector<U> &A) {
  T sum = 0;
  for (auto &&a: A) sum += a;
  return sum;
}

#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) \
  sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()

template <typename T>
T POP(deque<T> &que) {
  T a = que.front();
  que.pop_front();
  return a;
}
template <typename T>
T POP(pq<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(pqg<T> &que) {
  assert(!que.empty());
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(vc<T> &que) {
  assert(!que.empty());
  T a = que.back();
  que.pop_back();
  return a;
}

template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
  if (check_ok) assert(check(ok));
  while (abs(ok - ng) > 1) {
    auto x = (ng + ok) / 2;
    tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
  }
  return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
  FOR(iter) {
    double x = (ok + ng) / 2;
    tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
  }
  return (ok + ng) / 2;
}

template <class T, class S>
inline bool chmax(T &a, const S &b) {
  return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
  return (a > b ? a = b, 1 : 0);
}

// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
  vc<int> A(S.size());
  FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
  return A;
}

template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
  int N = A.size();
  vector<T> B(N + 1);
  FOR(i, N) { B[i + 1] = B[i] + A[i]; }
  if (off == 0) B.erase(B.begin());
  return B;
}

// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
  vector<int> ids(len(A));
  iota(all(ids), 0);
  sort(all(ids),
       [&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
  return ids;
}

// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
  vc<T> B(len(I));
  FOR(i, len(I)) B[i] = A[I[i]];
  return B;
}
#endif
#line 1 "library/other/io.hpp"
// based on yosupo's fastio
#include <unistd.h>

namespace fastio {
#define FASTIO
// クラスが read(), print() を持っているかを判定するメタ関数
struct has_write_impl {
  template <class T>
  static auto check(T &&x) -> decltype(x.write(), std::true_type{});

  template <class T>
  static auto check(...) -> std::false_type;
};

template <class T>
class has_write : public decltype(has_write_impl::check<T>(std::declval<T>())) {
};

struct has_read_impl {
  template <class T>
  static auto check(T &&x) -> decltype(x.read(), std::true_type{});

  template <class T>
  static auto check(...) -> std::false_type;
};

template <class T>
class has_read : public decltype(has_read_impl::check<T>(std::declval<T>())) {};

struct Scanner {
  FILE *fp;
  char line[(1 << 15) + 1];
  size_t st = 0, ed = 0;
  void reread() {
    memmove(line, line + st, ed - st);
    ed -= st;
    st = 0;
    ed += fread(line + ed, 1, (1 << 15) - ed, fp);
    line[ed] = '\0';
  }
  bool succ() {
    while (true) {
      if (st == ed) {
        reread();
        if (st == ed) return false;
      }
      while (st != ed && isspace(line[st])) st++;
      if (st != ed) break;
    }
    if (ed - st <= 50) {
      bool sep = false;
      for (size_t i = st; i < ed; i++) {
        if (isspace(line[i])) {
          sep = true;
          break;
        }
      }
      if (!sep) reread();
    }
    return true;
  }
  template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
  bool read_single(T &ref) {
    if (!succ()) return false;
    while (true) {
      size_t sz = 0;
      while (st + sz < ed && !isspace(line[st + sz])) sz++;
      ref.append(line + st, sz);
      st += sz;
      if (!sz || st != ed) break;
      reread();
    }
    return true;
  }
  template <class T, enable_if_t<is_integral<T>::value, int> = 0>
  bool read_single(T &ref) {
    if (!succ()) return false;
    bool neg = false;
    if (line[st] == '-') {
      neg = true;
      st++;
    }
    ref = T(0);
    while (isdigit(line[st])) { ref = 10 * ref + (line[st++] & 0xf); }
    if (neg) ref = -ref;
    return true;
  }
  template <typename T,
            typename enable_if<has_read<T>::value>::type * = nullptr>
  inline bool read_single(T &x) {
    x.read();
    return true;
  }
  bool read_single(double &ref) {
    string s;
    if (!read_single(s)) return false;
    ref = std::stod(s);
    return true;
  }
  bool read_single(char &ref) {
    string s;
    if (!read_single(s) || s.size() != 1) return false;
    ref = s[0];
    return true;
  }
  template <class T>
  bool read_single(vector<T> &ref) {
    for (auto &d: ref) {
      if (!read_single(d)) return false;
    }
    return true;
  }
  template <class T, class U>
  bool read_single(pair<T, U> &p) {
    return (read_single(p.first) && read_single(p.second));
  }
  template <size_t N = 0, typename T>
  void read_single_tuple(T &t) {
    if constexpr (N < std::tuple_size<T>::value) {
      auto &x = std::get<N>(t);
      read_single(x);
      read_single_tuple<N + 1>(t);
    }
  }
  template <class... T>
  bool read_single(tuple<T...> &tpl) {
    read_single_tuple(tpl);
    return true;
  }
  void read() {}
  template <class H, class... T>
  void read(H &h, T &... t) {
    bool f = read_single(h);
    assert(f);
    read(t...);
  }
  Scanner(FILE *fp) : fp(fp) {}
};

struct Printer {
  Printer(FILE *_fp) : fp(_fp) {}
  ~Printer() { flush(); }

  static constexpr size_t SIZE = 1 << 15;
  FILE *fp;
  char line[SIZE], small[50];
  size_t pos = 0;
  void flush() {
    fwrite(line, 1, pos, fp);
    pos = 0;
  }
  void write(const char val) {
    if (pos == SIZE) flush();
    line[pos++] = val;
  }
  template <class T, enable_if_t<is_integral<T>::value, int> = 0>
  void write(T val) {
    if (pos > (1 << 15) - 50) flush();
    if (val == 0) {
      write('0');
      return;
    }
    if (val < 0) {
      write('-');
      val = -val; // todo min
    }
    size_t len = 0;
    while (val) {
      small[len++] = char(0x30 | (val % 10));
      val /= 10;
    }
    for (size_t i = 0; i < len; i++) { line[pos + i] = small[len - 1 - i]; }
    pos += len;
  }
  void write(const string s) {
    for (char c: s) write(c);
  }
  void write(const char *s) {
    size_t len = strlen(s);
    for (size_t i = 0; i < len; i++) write(s[i]);
  }
  void write(const double x) {
    ostringstream oss;
    oss << fixed << setprecision(15) << x;
    string s = oss.str();
    write(s);
  }
  void write(const long double x) {
    ostringstream oss;
    oss << fixed << setprecision(15) << x;
    string s = oss.str();
    write(s);
  }
  template <typename T,
            typename enable_if<has_write<T>::value>::type * = nullptr>
  inline void write(T x) {
    x.write();
  }
  template <class T>
  void write(const vector<T> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
      if (i) write(' ');
      write(val[i]);
    }
  }
  template <class T, class U>
  void write(const pair<T, U> val) {
    write(val.first);
    write(' ');
    write(val.second);
  }
  template <size_t N = 0, typename T>
  void write_tuple(const T t) {
    if constexpr (N < std::tuple_size<T>::value) {
      if constexpr (N > 0) { write(' '); }
      const auto x = std::get<N>(t);
      write(x);
      write_tuple<N + 1>(t);
    }
  }
  template <class... T>
  bool write(tuple<T...> tpl) {
    write_tuple(tpl);
    return true;
  }
  template <class T, size_t S>
  void write(const array<T, S> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
      if (i) write(' ');
      write(val[i]);
    }
  }
  void write(i128 val) {
    string s;
    bool negative = 0;
    if (val < 0) {
      negative = 1;
      val = -val;
    }
    while (val) {
      s += '0' + int(val % 10);
      val /= 10;
    }
    if (negative) s += "-";
    reverse(all(s));
    if (len(s) == 0) s = "0";
    write(s);
  }
};
Scanner scanner = Scanner(stdin);
Printer printer = Printer(stdout);
void flush() { printer.flush(); }
void print() { printer.write('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
  printer.write(head);
  if (sizeof...(Tail)) printer.write(' ');
  print(forward<Tail>(tail)...);
}

void read() {}
template <class Head, class... Tail>
void read(Head &head, Tail &... tail) {
  scanner.read(head);
  read(tail...);
}
} // namespace fastio
using fastio::print;
using fastio::flush;
using fastio::read;

#define INT(...)   \
  int __VA_ARGS__; \
  read(__VA_ARGS__)
#define LL(...)   \
  ll __VA_ARGS__; \
  read(__VA_ARGS__)
#define STR(...)      \
  string __VA_ARGS__; \
  read(__VA_ARGS__)
#define CHAR(...)   \
  char __VA_ARGS__; \
  read(__VA_ARGS__)
#define DBL(...)      \
  double __VA_ARGS__; \
  read(__VA_ARGS__)

#define VEC(type, name, size) \
  vector<type> name(size);    \
  read(name)
#define VV(type, name, h, w)                     \
  vector<vector<type>> name(h, vector<type>(w)); \
  read(name)

void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 2 "library/geo/base.hpp"
template <typename T>
struct Point {
  T x, y;

  Point() = default;

  template <typename A, typename B>
  Point(A x, B y) : x(x), y(y) {}

  template <typename A, typename B>
  Point(pair<A, B> p) : x(p.fi), y(p.se) {}

  Point operator+(Point p) const { return {x + p.x, y + p.y}; }
  Point operator-(Point p) const { return {x - p.x, y - p.y}; }
  bool operator==(Point p) const { return x == p.x && y == p.y; }
  Point operator-() const { return {-x, -y}; }

  bool operator<(Point p) const {
    if (x != p.x) return x < p.x;
    return y < p.y;
  }
  T dot(Point other) { return x * other.x + y * other.y; }
  T det(Point other) { return x * other.y - y * other.x; }

  void read() { fastio::read(x), fastio::read(y); }
  void write() { fastio::printer.write(pair<T, T>({x, y})); }
};

// A -> B -> C と進むときに、左に曲がるならば +1、右に曲がるならば -1
template <typename T>
int ccw(Point<T> A, Point<T> B, Point<T> C) {
  T x = (B - A).det(C - A);
  if (x > 0) return 1;
  if (x < 0) return -1;
  return 0;
}

template <typename REAL, typename T>
REAL dist(Point<T> A, Point<T> B) {
  A = A - B;
  T p = A.dot(A);
  return sqrt(REAL(p));
}

template <typename T>
struct Line {
  T a, b, c;

  Line(T a, T b, T c) : a(a), b(b), c(c) {}
  Line(Point<T> A, Point<T> B) {
    a = A.y - B.y, b = B.x - A.x, c = A.x * B.y - A.y * B.x;
  }
  Line(T x1, T y1, T x2, T y2) : Line(Point<T>(x1, y1), Point<T>(x2, y2)) {}

  template <typename U>
  U eval(Point<U> P) {
    return a * P.x + b * P.y + c;
  }

  template <typename U>
  T eval(U x, U y) {
    return a * x + b * y + c;
  }

  bool is_parallel(Line other) { return a * other.b - b * other.a == 0; }

  bool is_orthogonal(Line other) { return a * other.a + b * other.b == 0; }
};

template <typename T>
struct Segment {
  Point<T> A, B;

  Segment(Point<T> A, Point<T> B) : A(A), B(B) {}
  Segment(T x1, T y1, T x2, T y2)
      : Segment(Point<T>(x1, y1), Point<T>(x2, y2)) {}

  template <enable_if_t<is_integral<T>::value, int> = 0>
  bool contain(Point<T> C) {
    T det = (C - A).det(B - A);
    if (det != 0) return 0;
    return (C - A).dot(B - A) >= 0 && (C - B).dot(A - B) >= 0;
  }

  Line<T> to_Line() { return Line(A, B); }
};

template <typename REAL>
struct Circle {
  Point<REAL> O;
  REAL r;
  Circle(Point<REAL> O, REAL r) : O(O), r(r) {}
  Circle(REAL x, REAL y, REAL r) : O(x, y), r(r) {}
  template <typename T>
  bool contain(Point<T> p) {
    REAL dx = p.x - O.x, dy = p.y - O.y;
    return dx * dx + dy * dy <= r * r;
  }
};

template <typename T>
struct Polygon {
  vc<Point<T>> points;
  T a;

  template <typename A, typename B>
  Polygon(vc<pair<A, B>> pairs) {
    for (auto&& [a, b]: pairs) points.eb(Point<T>(a, b));
    build();
  }
  Polygon(vc<Point<T>> points) : points(points) { build(); }

  int size() { return len(points); }

  template <typename REAL>
  REAL area() {
    return a * 0.5;
  }

  template <enable_if_t<is_integral<T>::value, int> = 0>
  T area_2() {
    return a;
  }

  bool is_convex() {
    FOR(j, len(points)) {
      int i = (j == 0 ? len(points) - 1 : j - 1);
      int k = (j == len(points) - 1 ? 0 : j + 1);
      if ((points[j] - points[i]).det(points[k] - points[j]) < 0) return false;
    }
    return true;
  }

private:
  void build() {
    a = 0;
    FOR(i, len(points)) {
      int j = (i + 1 == len(points) ? 0 : i + 1);
      a += points[i].det(points[j]);
    }
    if (a < 0) {
      a = -a;
      reverse(all(points));
    }
  }
};
#line 4 "main.cpp"

using Re = double;
using P = Point<Re>;

void solve() {
  VEC(P, R1, 4);
  VEC(P, R2, 4);
  P s, t;
  read(s), read(t);
  LL(K, N);
  auto F12 = [&](P p) -> P {
    P a = R1[1] - R1[0];
    P b = R1[3] - R1[0];
    p = p - R1[0];
    // p = xa + yb
    Re x = p.dot(a) / a.dot(a);
    Re y = p.dot(b) / b.dot(b);
    p.x = R2[0].x + x * (R2[1].x - R2[0].x) + y * (R2[3].x - R2[0].x);
    p.y = R2[0].y + x * (R2[1].y - R2[0].y) + y * (R2[3].y - R2[0].y);
    return p;
  };
  auto F21 = [&](P p) -> P {
    P a = R2[1] - R2[0];
    P b = R2[3] - R2[0];
    p = p - R2[0];
    // p = xa + yb
    Re x = p.dot(a) / a.dot(a);
    Re y = p.dot(b) / b.dot(b);
    p.x = R1[0].x + x * (R1[1].x - R1[0].x) + y * (R1[3].x - R1[0].x);
    p.y = R1[0].y + x * (R1[1].y - R1[0].y) + y * (R1[3].y - R1[0].y);
    return p;
  };

  vc<P> A(N + N + 1);
  A[N] = s;
  FOR_R(i, N) A[i] = F12(A[i + 1]);
  FOR(i, N, N + N) A[i + 1] = F21(A[i]);

  vc<P> B(N + N + 1);
  B[N] = t;
  FOR_R(i, N) B[i] = F12(B[i + 1]);
  FOR(i, N, N + N) B[i + 1] = F21(B[i]);

  Re ANS = infty<Re>;
  FOR(i, -N, N + N + 1) FOR(j, -N, N + N + 1) {
    ll k = abs(i) + abs(j);
    if (k > N) continue;
    Re cost = 0;
    cost += K * k;
    cost += dist<Re, Re>(A[N + i], B[N + j]);
    chmin(ANS, cost);
  }
  print(ANS);
}

signed main() {
  INT(T);
  FOR(T) solve();
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3836kb

input:

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

output:

1.000000000000000
1.227262335243029

result:

ok 2 numbers

Test #2:

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

input:

100
-133 -128 -109 -134 -85 -38 -109 -32
-95 -37 -100 -35 -108 -55 -103 -57
-119 -130 -112 -44
2 73
5 -100 5 -8 1 -8 1 -100
1 -60 1 -14 3 -14 3 -60
3 -84 1 -20
2 53
-58 -78 -66 -78 -66 -34 -58 -34
-58 -34 -66 -34 -66 -78 -58 -78
-63 -50 -63 -37
4 54
52 -148 116 -148 116 -52 52 -52
53 -103 53 -71 101...

output:

9.500657499741555
12.229731078922157
13.000000000000000
17.488532900375080
13.341664064126334
7.615773105863909
23.409399821439251
7.280109889280518
21.280037734083887
59.776022092579126
4.123105625617661
79.649231006959511
65.069193939989759
14.142135623730951
41.824615503479755
16.056245184896987
...

result:

ok 100 numbers

Test #3:

score: 0
Accepted
time: 6ms
memory: 3688kb

input:

100
-173 -113 -120 -113 -120 -115 -173 -115
-173 -115 -120 -115 -120 -113 -173 -113
-162 -114 -152 -114
99 57
6 23 -75 4 -56 -77 25 -58
0 -58 -51 -69 -62 -18 -11 -7
-22 -56 -42 -25
19 27
-98 -115 -150 -147 -158 -134 -106 -102
-150 -147 -98 -115 -106 -102 -158 -134
-103 -111 -136 -134
25 50
136 -92 1...

output:

10.000000000000000
25.483637975584365
40.224370722237531
18.384776310850235
9.219544457292887
18.027756377319946
43.114063026280363
52.887044352349008
45.541190146942803
55.000999975001250
37.000000000000000
12.041594578792296
24.331050121192877
18.110770276274835
7.563262753279504
2.236067977499790...

result:

ok 100 numbers

Test #4:

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

input:

100
-12 -206 72 -188 135 -482 51 -500
19 -301 23 -301 23 -315 19 -315
88 -368 28 -248
14 87
-221 -566 -467 -566 -467 -565 -221 -565
-221 -566 -467 -566 -467 -565 -221 -565
-297 -566 -289 -566
274 18
-264 759 -339 609 -129 504 -54 654
-208 580 -208 655 -103 655 -103 580
-196 664 -211 596
8 64
-111 -3...

output:

34.246950475544253
8.000000000000000
45.926952286842969
135.118466539551889
131.973482184869255
40.349665953953490
15.321347728712500
77.772275035020499
66.738813035899369
8.000266654815924
116.806446031673104
12.588290015615986
170.785630266285750
131.962750429094399
8.738089975160305
17.4642491965...

result:

ok 100 numbers

Test #5:

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

input:

100
-235 -704 133 -704 133 -720 -235 -720
-224 -712 -40 -712 -40 -704 -224 -704
15 -711 76 -718
4 74
-467 574 -475 596 -123 724 -115 702
-274 662 -270 652 -430 588 -434 598
-458 588 -241 657
15 31
380 -3 532 -343 787 -229 635 111
503 -71 639 -163 708 -61 572 31
533 -189 613 -137
3 58
-460 -7 -488 -7...

output:

31.350081433008754
51.967632320937959
21.468697928146717
38.837932076467766
84.248187428308029
77.929455278476055
47.000000000000000
74.115493725912501
86.467104880421701
35.114099732158877
3.605551275463989
97.416631023660429
24.606056965764580
56.773359432723908
6.998534619414935
13.45362404707371...

result:

ok 100 numbers

Test #6:

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

input:

100
-1201 2822 -1197 2814 -3437 1694 -3441 1702
-3119 1860 -3117 1856 -1997 2416 -1999 2420
-1419 2709 -2491 2174
48 76
-2515 285 -2547 306 -1308 2194 -1276 2173
-2255 683 -2260 686 -2083 981 -2078 978
-1572 1753 -1392 2015
121 28
-1216 1209 -1498 -1141 -1598 -1129 -1316 1221
-1494 -823 -1494 -447 -...

output:

264.055863532879016
290.425700450936574
258.282400313066319
743.737184763542700
341.052781838823307
400.566683662432695
172.040799340956909
27.770894609837494
294.825880152081140
508.065910688872975
501.781825099315427
666.805068966935778
180.069431053691062
193.610433603150625
1507.002986062071386
...

result:

ok 100 numbers

Test #7:

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

input:

100
1411 -2755 603 -3563 623 -3583 1431 -2775
716 -3477 1120 -3073 1110 -3063 706 -3467
1210 -2959 1339 -2830
2319 39
4528 -3417 4286 -4055 1908 -3153 2150 -2515
2094 -2892 2094 -3090 2832 -3090 2832 -2892
2257 -2993 4389 -3736
17 22
-180 -1673 -2172 -3665 -2164 -3673 -172 -1681
-284 -1792 -2027 -35...

output:

182.433549546129257
96.880923053928399
530.330085889910606
44.011362169330773
64.313365366181941
7.392893666126233
34.567810207462088
148.850160742992557
350.338135916148133
329.225162779821233
68.864765108872987
32.824383174612819
244.695729427384975
685.968837711980996
141.362747995939316
1601.789...

result:

ok 100 numbers

Test #8:

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

input:

100
11928 -18111 8928 -17411 11056 -8291 14056 -8991
11043 -10811 10793 -10111 12921 -9351 13171 -10051
10491 -14092 11923 -12413
10 92
11869 -4371 3539 5429 1299 3525 9629 -6275
8302 -3064 3647 2571 4935 3635 9590 -2000
2384 2680 3466 2644
181 91
4001 -10187 4001 -10897 9 -10897 9 -10187
838 -10629...

output:

87.479657002630546
977.209322820567536
94.486325059360709
307.006514588860171
1245.629559700635809
532.000000000000000
369.048777263927548
19.554024317231864
1509.000000000000000
275.094267211329623
4242.193351514708411
465.656251408810249
3478.304242060181878
1754.356007200362910
1804.4669275859330...

result:

ok 100 numbers

Test #9:

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

input:

100
10303 -4099 19487 -8131 19703 -7639 10519 -3607
18394 -7495 18842 -7271 18854 -7295 18406 -7519
15852 -6248 15950 -6389
38 10
13132 -3411 17416 3393 15634 4515 11350 -2289
13143 -873 15411 3411 16533 2817 14265 -1467
16515 2577 16017 1561
198 94
-5480 10872 -6297 11294 -11361 1490 -10544 1068
-1...

output:

84.574886489291558
999.689277678129997
6231.529667746114683
550.947886095035528
182.544124658605369
5374.296791209059847
825.725781096656874
1653.207429169170609
2777.109648537486009
166.653023806101686
1747.004579272761930
651.111357603290458
242.210006732269051
34.266895846221601
286.7908645685911...

result:

ok 100 numbers

Test #10:

score: 0
Accepted
time: 6ms
memory: 3596kb

input:

100
0 -30 84 12 126 -72 42 -114
0 -30 84 12 126 -72 42 -114
91 -41 100 -55
96 93
168 110 148 150 48 100 68 60
48 100 68 60 168 110 148 150
61 96 102 90
8 2
-123 129 -60 174 -15 111 -78 66
-15 111 -78 66 -123 129 -60 174
-44 115 -104 132
27 3
27 42 15 54 -75 -36 -63 -48
-63 -48 -75 -36 15 54 27 42
-4...

output:

16.643316977093239
41.436698710201320
39.206555615733706
11.180339887498949
49.729267036625423
26.925824035672520
50.931326312987373
10.294055820165386
117.885537705012823
8.602325267042627
48.466483264210538
21.095023109728988
24.038404810405297
16.000000000000000
48.548944375753422
26.061756859551...

result:

ok 100 numbers

Test #11:

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

input:

100
9725 6731 9725 11971 14965 11971 14965 6731
9725 6731 9725 11971 14965 11971 14965 6731
10293 11185 10445 9833
488 10
3833 -4831 6913 -4271 8443 -12686 5363 -13246
6913 -4271 3833 -4831 5363 -13246 8443 -12686
5209 -4960 7133 -6409
1 88
-5891 -6066 -8365 -6066 -8365 -8540 -5891 -8540
-8365 -6066...

output:

1360.517548582156223
2119.674780139698214
1638.601494195408577
144.699689011414250
1706.299211744528748
2671.668018298680636
1442.324859385013951
2909.931270666027103
5311.386353862802935
7894.844203655952697
2950.721437208195766
1405.197279587166804
8052.785977535972961
436.084854128184531
1910.190...

result:

ok 100 numbers

Test #12:

score: 0
Accepted
time: 7ms
memory: 3812kb

input:

100
1432065 -1359744 1432065 -1359796 610089 -1359796 610089 -1359744
610089 -1359744 610089 -1359796 1432065 -1359796 1432065 -1359744
1413145 -1359747 670086 -1359765
306 12
-630899 -570942 344981 -570942 344981 -567164 -630899 -567164
-630899 -567164 344981 -567164 344981 -570942 -630899 -570942
...

output:

41383.003943812647776
344430.708764477050863
597464.947160122334026
57512.000021251275029
180112.504983949213056
254594.189465463656234
13301.834367630941415
246235.741341503860895
17086.953736696308624
168329.001188149384689
580568.278437601169571
120047.475965045188786
24722.575937794183119
252882...

result:

ok 100 numbers

Test #13:

score: 0
Accepted
time: 7ms
memory: 3596kb

input:

100
-240497 1168822 -365542 931192 504344 473443 629389 711073
226221 683190 167481 688085 185400 903113 244140 898218
-192129 1110656 34450 941656
2 25
1729381 25950 1512625 519672 1528369 526584 1745125 32862
1536820 492965 1580974 388601 1584302 390009 1540148 494373
1660204 207517 1601591 344571...

output:

33.523773639131214
126504.999518608878134
57518.293697333065211
318943.663702541671228
169769.250005668785889
1497.133893067331201
23459.324991965091613
853.347816095360486
28.351411845905108
7526.106524036477822
36705.816569039845490
575.015321674938605
4025.084882224849480
31458.023666467033763
31...

result:

ok 100 numbers

Test #14:

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

input:

100
-889209 606569 -191736 1436894 638589 739421 -58884 -90904
-58884 -90904 638589 739421 -191736 1436894 -889209 606569
-486300 891465 -464854 988546
79 18
-1226546 957048 -712144 1926170 -590407 1861553 -1104809 892431
-712144 1926170 -1226546 957048 -1104809 892431 -590407 1861553
-807239 146415...

output:

99421.584562910677050
404181.388824374240357
311311.528917577990796
271785.624537060444709
319158.191839094099123
77725.025543495052261
103690.241569289937615
33781.004277552201529
16708.608350188831537
262422.768227149092127
176381.843093329749536
159818.483940375299426
451836.634220813575666
29166...

result:

ok 100 numbers