QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#107576#5570. Epidemic EscapemaspyAC ✓927ms21132kbC++2325.2kb2023-05-22 01:27:342023-05-22 01:27:34

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-22 01:27:34]
  • 评测
  • 测评结果:AC
  • 用时:927ms
  • 内存:21132kb
  • [2023-05-22 01:27:34]
  • 提交

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 3 "main.cpp"

#line 1 "library/nt/rational.hpp"
template <typename T = long long, bool REDUCE = true>
struct Rational {
  T num, den;

  Rational() : num(0), den(1) {}
  Rational(T x) : num(x), den(1) {}
  Rational(T a, T b, bool coprime = false) : num(a), den(b) {
    if (!coprime && REDUCE) reduce();
  }

  static T gcd(T a, T b) {
    a = max(a, -a), b = max(b, -b);
    while (b) {
      a %= b;
      swap(a, b);
    }
    return a;
  }

  void reduce() {
    if (!REDUCE) return;
    T g = gcd(num, den);
    num /= g, den /= g;
  }

  Rational &operator+=(const Rational &p) {
    T g = (REDUCE ? gcd(den, p.den) : 1);
    num = num * (p.den / g) + p.num * (den / g);
    den *= p.den / g;
    reduce();
    return *this;
  }
  Rational &operator-=(const Rational &p) {
    T g = (REDUCE ? gcd(den, p.den) : 1);
    num = num * (p.den / g) - p.num * (den / g);
    den *= p.den / g;
    reduce();
    return *this;
  }
  Rational &operator*=(const Rational &p) {
    T g1 = (REDUCE ? gcd(num, p.den) : 1);
    T g2 = (REDUCE ? gcd(den, p.num) : 1);
    num = (num / g1) * (p.num / g2);
    den = (den / g2) * (p.den / g1);
    return *this;
  }
  Rational &operator/=(const Rational &p) {
    T g1 = (REDUCE ? gcd(num, p.num) : 1);
    T g2 = (REDUCE ? gcd(den, p.den) : 1);
    num = (num / g1) * (p.den / g2);
    den = (den / g2) * (p.num / g1);
    if (den < 0) num = -num, den = -den;
    return *this;
  }

  Rational operator-() const { return Rational(-num, den); }
  Rational operator+(const Rational &p) const { return Rational(*this) += p; }
  Rational operator-(const Rational &p) const { return Rational(*this) -= p; }
  Rational operator*(const Rational &p) const { return Rational(*this) *= p; }
  Rational operator/(const Rational &p) const { return Rational(*this) /= p; }
  bool operator==(const Rational &p) const {
    return num * p.den == p.num * den;
  }
  bool operator!=(const Rational &p) const {
    return num * p.den != p.num * den;
  }
  bool operator<(const Rational &p) const { return num * p.den < p.num * den; }
  bool operator>(const Rational &p) const { return num * p.den > p.num * den; }
  bool operator<=(const Rational &p) const {
    return num * p.den <= p.num * den;
  }
  bool operator>=(const Rational &p) const {
    return num * p.den >= p.num * den;
  }

  string to_string() { return std::to_string(num) + "/" + std::to_string(den); }
  double to_double() { return double(num) / double(den); }
};
#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 2 "library/geo/convex_hull.hpp"

template <typename T>
vector<int> ConvexHull(vector<pair<T, T>>& XY, string mode = "full",
                       bool inclusive = false, bool sorted = false) {
  assert(mode == "full" || mode == "lower" || mode == "upper");
  ll N = XY.size();
  if (N == 1) return {0};
  if (N == 2) return {0, 1};
  vc<int> I = argsort(XY);

  auto check = [&](ll i, ll j, ll k) -> bool {
    auto xi = XY[i].fi, yi = XY[i].se;
    auto xj = XY[j].fi, yj = XY[j].se;
    auto xk = XY[k].fi, yk = XY[k].se;
    auto dx1 = xj - xi, dy1 = yj - yi;
    auto dx2 = xk - xj, dy2 = yk - yj;
    T det = dx1 * dy2 - dy1 * dx2;
    return (inclusive ? det >= 0 : det > 0);
  };

  auto calc = [&]() {
    vector<int> P;
    for (auto&& k: I) {
      while (P.size() > 1) {
        auto i = P[P.size() - 2];
        auto j = P[P.size() - 1];
        if (check(i, j, k)) break;
        P.pop_back();
      }
      P.eb(k);
    }
    return P;
  };

  vc<int> P;
  if (mode == "full" || mode == "lower") {
    vc<int> Q = calc();
    P.insert(P.end(), all(Q));
  }
  if (mode == "full" || mode == "upper") {
    if (!P.empty()) P.pop_back();
    reverse(all(I));
    vc<int> Q = calc();
    P.insert(P.end(), all(Q));
  }
  if (mode == "upper") reverse(all(P));
  if (len(P) >= 2 && P[0] == P.back()) P.pop_back();
  return P;
}

template <typename T>
vector<int> ConvexHull(vector<Point<T>>& XY, string mode = "full",
                       bool inclusive = false, bool sorted = false) {
  assert(mode == "full" || mode == "lower" || mode == "upper");
  ll N = XY.size();
  if (N == 1) return {0};
  if (N == 2) return {0, 1};
  vc<int> I = argsort(XY);

  auto check = [&](ll i, ll j, ll k) -> bool {
    auto xi = XY[i].x, yi = XY[i].y;
    auto xj = XY[j].x, yj = XY[j].y;
    auto xk = XY[k].x, yk = XY[k].y;
    auto dx1 = xj - xi, dy1 = yj - yi;
    auto dx2 = xk - xj, dy2 = yk - yj;
    T det = dx1 * dy2 - dy1 * dx2;
    return (inclusive ? det >= 0 : det > 0);
  };

  auto calc = [&]() {
    vector<int> P;
    for (auto&& k: I) {
      while (P.size() > 1) {
        auto i = P[P.size() - 2];
        auto j = P[P.size() - 1];
        if (check(i, j, k)) break;
        P.pop_back();
      }
      P.eb(k);
    }
    return P;
  };

  vc<int> P;
  if (mode == "full" || mode == "lower") {
    vc<int> Q = calc();
    P.insert(P.end(), all(Q));
  }
  if (mode == "full" || mode == "upper") {
    if (!P.empty()) P.pop_back();
    reverse(all(I));
    vc<int> Q = calc();
    P.insert(P.end(), all(Q));
  }
  if (mode == "upper") reverse(all(P));
  if (len(P) >= 2 && P[0] == P.back()) P.pop_back();
  return P;
}
#line 1 "library/geo/convex_polygon.hpp"

template <typename T>
struct ConvexPolygon {
  using P = Point<T>;
  int n;
  vc<P> point;

  ConvexPolygon(vc<P> point) : n(len(point)), point(point) { assert(n >= 1); }

  // 比較関数 comp(i,j)
  template <typename F>
  int periodic_min_comp(F comp) {
    int L = 0, M = n, R = n + n;
    while (1) {
      if (R - L == 2) break;
      int L1 = (L + M) / 2, R1 = (M + R + 1) / 2;
      if (comp(L1, M)) { R = M, M = L1; }
      elif (comp(R1, M)) { L = M, M = R1; }
      else {
        L = L1, R = R1;
      }
    }
    return M % n;
  }

  int nxt_idx(int i) { return (i + 1 == n ? 0 : i + 1); }
  int prev_idx(int i) { return (i == 0 ? n - 1 : i - 1); }

  // 中:1, 境界:0, 外:-1
  // int side(P p) {}

  pair<int, T> min_dot(P p) {
    int idx = periodic_min_comp([&](int i, int j) -> bool {
      return point[i % n].dot(p) < point[j % n].dot(p);
    });
    return {idx, point[idx].dot(p)};
  }
  pair<int, T> max_dot(P p) {
    int idx = periodic_min_comp([&](int i, int j) -> bool {
      return point[i % n].dot(p) > point[j % n].dot(p);
    });
    return {idx, point[idx].dot(p)};
  }
  // pair<int, int> visible_range(P p) {}
};
#line 7 "main.cpp"

using Re = long double;

// using QQ = Rational<i128, false>;

void solve() {
  LL(N);
  VEC(pi, AB, N);
  ll O = 0;
  {
    vc<pi> tmp;
    for (auto&& [a, b]: AB) {
      if (a == 0 && b == 0) {
        ++O;
      } else {
        tmp.eb(a, b);
      }
    }
    swap(AB, tmp);
    N = len(AB);
  }

  using P = Point<Re>;
  vc<P> point(N);
  FOR(i, N) {
    auto [a, b] = AB[i];
    point[i].x = Re(a) / (a * a + b * b);
    point[i].y = Re(b) / (a * a + b * b);
  }

  using Poly = ConvexPolygon<Re>;
  vc<Poly> hull;
  FOR(5) {
    N = len(point);
    if (point.empty()) break;
    vc<int> I = ConvexHull<Re>(point, "full");
    vc<bool> use(N);
    for (auto&& i: I) use[i] = 1;
    vc<Point<Re>> polygon;
    for (auto&& idx: I) { polygon.eb(point[idx]); }
    vc<P> rest;
    FOR(i, N) {
      if (!use[i]) rest.eb(point[i]);
    }
    hull.eb(ConvexPolygon<Re>(polygon));
    swap(point, rest);
  }

  auto solve = [&](ll x, ll y, ll k) -> void {
    if (x == 0 && y == 0) return print(-1);
    if (k < O) { return print(0.0); }
    k -= O;
    vc<Re> ts;
    Point<Re> p = {x, y};
    for (auto&& poly: hull) {
      int idx = poly.max_dot(p).fi;
      vc<int> I;
      int i = idx;
      FOR(5) {
        I.eb(i);
        i = poly.prev_idx(i);
      }
      i = idx;
      FOR(5) {
        I.eb(i);
        i = poly.nxt_idx(i);
      }
      UNIQUE(I);
      for (auto&& idx: I) {
        Re dot = p.dot(poly.point[idx]);
        if (dot <= 0) continue;
        ts.eb(dot);
      }
    }
    sort(all(ts));
    reverse(all(ts));
    if (len(ts) <= k) { return print(-1); }
    Re ANS = 1.0 / ts[k];
    Re d = sqrtl(x * x + y * y);
    ANS *= d / 2;
    print(ANS);
  };

  LL(Q);
  FOR(Q) {
    LL(x, y, k);
    --k;
    solve(x, y, k);
  }
}

signed main() {
  solve();
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

8.700255424092125
3.226019562257254

result:

ok 2 numbers

Test #2:

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

input:

8
4 -1
4 -8
0 9
4 -7
-5 -2
5 -5
7 5
-9 2
10
4 -8 1
7 -7 5
-10 8 2
-9 9 2
4 -7 5
-1 -10 2
6 -3 2
2 -9 3
-10 -10 1
5 9 1

output:

3.167762968124702
26.162950903902258
5.461488320163312
6.363961030678928
-1
5.289408221642574
3.726779962499649
4.609772228646444
2.929442379201411
4.761728940206488

result:

ok 10 numbers

Test #3:

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

input:

5
-4 -7
5 0
2 4
-7 -7
4 4
20
0 -5 2
-4 -7 2
-7 7 3
4 -4 3
-7 4 3
4 -4 1
2 4 1
6 -7 2
4 -4 2
4 4 3
5 4 1
-1 9 2
8 9 3
4 -4 2
6 3 3
-10 -3 2
-7 7 1
9 -4 1
-4 -7 3
-2 0 2

output:

7.000000000000000
5.130527658008168
-1
-1
-1
3.535533905932738
2.236067977499790
11.985407794480754
15.320646925708530
3.535533905932738
2.462740091320326
4.527692569068708
3.762998305872592
15.320646925708530
2.981423969999720
5.621703504797989
7.071067811865475
2.735793833832251
-1
8.125000000000000

result:

ok 20 numbers

Test #4:

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

input:

100
63 -48
20 -62
-81 -31
-17 -93
2 -74
72 25
-71 37
-71 17
56 67
-47 65
-89 14
62 30
-71 -33
14 -53
-57 -52
30 80
-14 -69
-45 -19
-54 -71
58 -20
-57 12
5 -56
-76 -2
26 61
24 60
10 -97
-63 38
17 81
-43 -38
44 35
-86 37
62 72
77 11
41 29
14 81
77 55
-54 -33
-43 -51
76 14
55 47
43 24
69 -13
16 75
11 9...

output:

26.758678868757292
29.571405997861689
24.622144504490262
27.771745654730640
26.678366712896510
24.423702460472157
28.893348196396305
29.776169557758460
31.940362970515170
27.214901602377858
31.728095045748500
27.071160551681187
25.299110030617503
26.871065152124929
28.995839453427889
28.356314246197...

result:

ok 100 numbers

Test #5:

score: 0
Accepted
time: 41ms
memory: 4476kb

input:

10000
-3 3
-6 2
-4 1
-2 -5
5 -6
-7 -2
0 7
1 -4
8 0
-4 4
-6 -2
5 0
2 9
-4 -8
0 -8
7 4
-7 2
3 3
4 1
-1 7
-4 -2
6 0
3 -5
-7 2
0 -9
7 0
7 3
-6 0
1 7
6 2
2 -9
1 8
3 -3
2 -9
4 2
4 -5
6 0
-3 6
7 3
0 8
0 -4
7 0
-5 8
5 -5
-5 -1
0 9
-4 -3
-9 -1
7 -2
-7 -2
4 0
-6 6
-3 4
6 7
2 5
-8 -5
0 5
4 0
0 -4
0 -6
-5 3
-5 ...

output:

2.154917004616741
2.167265935742733
2.067643085494710
2.111841978749801
2.111841978749801
2.111841978749801
2.124987278610405
2.121320343559643
2.027587510099407
2.092882282881672
2.141537214391802
2.061552812808830
2.154917004616741
2.000000000000000
2.121320343559643
2.167265935742733
2.0676430854...

result:

ok 10000 numbers

Test #6:

score: 0
Accepted
time: 47ms
memory: 4504kb

input:

10000
-90174 318421
-37261 138897
-260388 -302590
-906833 35071
317743 -283220
390311 -85301
880987 325969
-315218 -116767
103089 -8223
-134988 -973121
-444593 229407
-552060 549321
265624 -337609
-264546 322379
28687 110143
467764 303005
-335748 32188
213125 274156
240105 751
-81255 -129323
148563 ...

output:

218.302375937283414
481.662711989051483
792.185075601818457
579.954261849271088
807.709446267823633
242.592175484557102
882.267514766716129
530.780780259741816
664.182175961040366
796.360739767516690
662.707167898652969
639.072619278744072
125.821182715262989
745.729175266718648
732.496721810002771
...

result:

ok 10000 numbers

Test #7:

score: 0
Accepted
time: 462ms
memory: 17056kb

input:

100000
-14593321 17388753
13488647 1223793
33907737 -8731155
-14502324 73522129
-13933178 -13752140
9462275 13349398
14636622 31405249
5160247 -69775840
-49415260 -40092130
-9926862 -25806124
14982829 -8025116
-5492901 4568113
48872077 86636033
19374632 32538501
-16657133 -11624530
-15398598 -966935...

output:

1331.497776332412464
1193.960228745125253
1171.242726187059776
1856.289036299030643
2681.882945853973961
1170.870740836292975
1128.361471572152698
1855.878337989197236
3518.324147970210843
1541.786008215449948
1515.015122316480641
1124.406566046596438
2146.716711313767568
1179.430678947101310
1164.1...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 705ms
memory: 16384kb

input:

100000
-60674143 79489917
99210432 12541486
-99948887 -3196593
57015830 -82153478
10407645 99456921
-90320128 42921703
93983821 34161956
96773928 -25195355
69603194 71801068
27259746 -96212811
96031961 27890165
76618755 -64261689
-99095784 13417302
-95521354 -29591717
-34815155 -93743823
-93393132 -...

output:

49999995.081866194097529
49999995.900409112364287
49999995.314921701381536
49999995.305467400230555
49999994.557705009294295
49999996.486281426608912
49999994.694073243023013
49999995.136890397647221
49999995.725543791475502
49999995.493763089114509
49999997.256773307606636
49999994.794401760413166
...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 708ms
memory: 15620kb

input:

100000
28442101 95869943
64560849 76366848
-85662377 51594149
95580169 -29401185
-40181553 -91572058
67627360 -73665047
82527643 56472888
29700208 95487675
87983116 -47528622
62992785 77665358
-2222699 99975284
-64132427 76726992
-76047272 64936977
87016456 49276108
95274227 30377974
-62944509 -7770...

output:

49999994.830971039027645
49999995.518378859214863
49999994.925178702054836
49999995.523494692220993
49999994.827552508486406
49999994.639485793537460
49999994.867817235783150
49999996.471334265297628
49999995.023386690660118
49999995.403333524864138
49999994.991643111588928
49999994.903046394138073
...

result:

ok 100000 numbers

Test #10:

score: 0
Accepted
time: 693ms
memory: 16748kb

input:

100000
66926611 74302272
-39804607 -91736532
-31850108 94792239
-94396583 -33004302
-57766222 81627580
-80246004 59670576
74979879 -66166588
37426246 -92732280
-40775354 -91309200
99674197 8065507
94244794 -33435279
-24613128 -96923641
28694420 -95794726
97637671 -21607478
-49066338 -87134919
612455...

output:

49999995.771590814834781
49999995.435777232676628
49999996.404374188263319
49999994.817978932700498
49999997.228506044582900
49999995.858285148413415
49999995.082532043776155
49999994.540230161761428
49999994.617978084679635
49999995.490942620494025
49999995.585105677888350
49999994.758131145692460
...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 695ms
memory: 16044kb

input:

100000
31516589 94903656
70239724 71178504
-57719682 81660501
73612201 67684871
82391354 -56671542
72801723 -68555878
26893692 -96315770
-83483265 55050367
87478845 -48450493
-85026739 52635096
-26511823 96421583
95776532 -28755096
88242174 -47045913
77725402 -62918677
-14344932 98965762
-25054341 -...

output:

49999995.141660989098455
49999995.174206868821784
49999995.857972349487682
49999997.130423228540167
49999995.656523763726000
49999995.244142084713530
49999995.351639151060226
49999994.682423661215580
49999995.639157219186018
49999995.616699607344344
49999995.075805490971106
49999997.023112344770198
...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 691ms
memory: 16728kb

input:

100000
-77953946 -62635297
-97003745 24295529
-95559516 -29468254
-37774475 -92590972
-78235761 62282941
24449261 96965108
-32126090 -94699061
-90361637 -42834246
-15234257 -98832767
-67393723 -73878858
-77089954 63695658
-87433336 -48532575
45142341 -89230981
80543145 -59268883
99006350 -14062036
-...

output:

49999994.880060998442787
49999995.603644348382659
49999995.447316431040235
49999994.823428611969575
49999994.781436592664249
49999994.975797457649605
49999994.991833258391125
49999996.428883731052338
49999995.492081234559009
49999996.178407670922752
49999995.157536116046685
49999994.522759268507798
...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 702ms
memory: 15956kb

input:

100000
-14994761 -98790003
-52791662 84821895
87513045 48313812
19785427 97922747
98912337 -14130131
-4520530 -99837938
93690283 34834919
99547007 8570663
86380533 -50241768
-46722739 88350371
69496929 -71791216
-85910197 -51161960
5199588 99844597
11410781 -99298438
-99814172 5122831
99748209 57815...

output:

49950309.305623798780289
49950587.932118381420878
49950271.255197481925279
49950284.225095447520289
49950441.670937611776026
49950141.284682230172621
49950288.376649725531024
49950469.218390780741174
49950744.146402866077551
49950688.231202568345907
49950339.567655365441169
49950216.298886935070186
...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 705ms
memory: 16456kb

input:

100000
87107311 49115334
-98093001 -19436093
86159431 -50759733
-90576186 -42378693
99725385 7405849
-93030414 -36678893
7164898 99742981
88908273 -45774642
-87848897 47776244
98650729 -16371688
-13992770 99016167
-36675953 93031566
-28482368 95857989
-38312130 -92369793
86372731 50395931
-50997291 ...

output:

49999995.779722548271820
49999994.624587604765111
49999998.350963777145807
49999995.511578413857933
49999995.093349861817842
49999994.883617811370641
49999997.988645042678399
49999996.229594565666048
49999998.044167980657221
49999995.861839284592861
49999996.739281407615636
49999996.206184936090722
...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 706ms
memory: 15784kb

input:

100000
87353211 -48676647
78574311 -61855286
1089525 99994063
-99999914 -125343
-79940915 -60078697
97608574 -21738565
-99570798 9254977
-57082835 -82106930
77989099 62591525
-36640991 -93045345
-82795 -99999957
99857762 5331654
91364668 40650900
-89488349 -44629962
24733984 96892872
87543386 483337...

output:

49999998.411488482608547
49999997.973176549050550
49999997.272540736132214
49999998.460908200693666
49999994.772624863122473
49999996.259143746668997
49999997.439160200268816
49999997.459515248418029
49999994.946354985273501
49999996.920755286988424
49999997.973508603223308
49999996.570999907806254
...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 704ms
memory: 17516kb

input:

100000
-95807142 28504127
58593535 -80943524
-99766431 5986168
93220087 -35989826
3645498 -99841657
69856363 -71476864
6430623 99747801
99074166 -13444307
25226151 96750874
-99820804 -4584947
80958147 58644185
99854141 3972407
93127038 36267563
83656508 -54710699
73943321 -67286687
22540877 -9736065...

output:

49951675.876473774322221
49951660.775972730512876
49951740.411405605522305
49951465.463830402768508
49950200.257747123614536
49950954.513078985393804
49951162.320407849354524
49950823.998722999640449
49951011.436462436722650
49951169.761441687627666
49950251.987086872613872
49950960.896749847801402
...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 723ms
memory: 16632kb

input:

100000
-18866705 98167110
96374803 -26445175
-90527905 42406852
93525949 35171769
-99675297 7020406
-99946706 -2220134
31631621 -94776631
-46384811 88576816
-2476324 99950315
69306249 -72003171
-30910251 -95067123
85457008 51882654
82372940 -56613508
6032490 99757677
99488049 -9473775
97295326 22667...

output:

49950435.434246316810459
49950523.642917789293278
49951727.036867384849756
49950791.719709172703006
49952062.184669759983080
49951220.303715848509455
49950723.943454428572295
49951030.275169040349283
49951362.775559423796949
49951028.050887623030576
49951744.114112308772746
49951224.743764479546371
...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 685ms
memory: 16980kb

input:

100000
-94544376 30244008
-5524553 -99134196
64736465 74935295
-10781223 -98537615
-27540414 96110283
94534101 -30554453
-49000527 -87040163
-70553197 70503800
90093758 -41264733
51497088 84792240
-50688507 -85177162
95747827 28411115
-85773541 -50275968
-34190721 93830767
-42611828 90282250
-315970...

output:

49503286.607134186222538
49503940.166000419914781
49500902.057453068748146
49502328.800176266817289
49504050.889942574940505
49503864.711322440307413
49502762.950223184918286
49505338.454382405128854
49503140.182894040543033
49508220.513647646417667
49506314.734897071150044
49508005.396764063756564
...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 689ms
memory: 16960kb

input:

100000
-72724429 68353169
-23398454 96972722
98697156 15295066
-50053634 86257978
95660227 -25689933
-98427638 12257835
-95720479 25986032
99360720 -9958797
-34453585 -93167496
97657115 21470158
-61854668 77939046
-78666489 60608092
99656422 -4271277
37176490 92108858
92266107 -36908241
84966021 -52...

output:

49505232.252246210442536
49505902.953028409963736
49506391.351798933890677
49501384.861999809636472
49501974.537536787520366
49503956.292127488577535
49506260.848440491648944
49507848.957843135813164
49507844.197724983576336
49507646.915987907894305
49505334.211140326005989
49504283.430571332472027
...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 694ms
memory: 16876kb

input:

100000
-98189095 15784434
89982407 42479712
-98538151 10378719
48446566 -87123427
90936804 -40512021
67828507 72315413
-19102654 97627943
-40632682 -90422395
-71928032 68028353
59463681 -80194272
-61979681 77927882
-89859188 -41650204
-40753972 -90873220
-31802337 -94326140
29901118 94629634
8981744...

output:

49501432.702204376466398
49504111.900015640272613
49506914.003728361902176
49504020.384162565314909
49500748.180829021737736
49509533.281617566495697
49504423.651492847446207
49503519.126497320641647
49507687.166234923042794
49501887.845157291212672
49501129.473850547958136
49506066.784948171527503
...

result:

ok 100000 numbers

Test #21:

score: 0
Accepted
time: 675ms
memory: 15836kb

input:

100000
74210313 -66772568
-82118759 55744795
-40558611 -90552265
-80801514 58093666
-87555090 46582002
-96330979 24086781
39402894 91628283
56594773 -82141487
39313600 91784698
89239441 43417687
-95774367 28264902
32961837 93669012
-85873036 -51077556
-27532569 -96083438
82705246 -55505999
-22508180...

output:

49506572.911400130680704
49507188.369827933773195
49504015.586849221999728
49502226.255133686427143
49511712.379165468359133
49508088.372565753328672
49508038.472160665467527
49511153.945943726677797
49503445.764425133045734
49505408.242235635923862
49501120.219141721721826
49504635.794690128896036
...

result:

ok 100000 numbers

Test #22:

score: 0
Accepted
time: 683ms
memory: 17036kb

input:

100000
-71207198 55424979
-79825607 -56036270
-83654833 37345395
-91097555 -17973035
-79663519 53088655
40943861 -91076400
84688501 31061641
-96431516 -1566452
-89205053 17120308
66023621 -67658770
-85253305 44553904
-95493219 -8941382
-79301859 45970085
-27319544 -90541866
-90379686 -10409784
-8376...

output:

45036750.137223908059241
45027842.881813562722527
45013570.764970868873206
45012430.846758678955666
45008268.508002057882550
45035953.625102698442788
45011940.326686440705089
45033497.637868723384599
45035993.031780931094545
45018438.552473084320809
45010458.610915556204418
45008354.725905186467571
...

result:

ok 100000 numbers

Test #23:

score: 0
Accepted
time: 660ms
memory: 15260kb

input:

100000
38905528 81237636
-87968422 -27436984
9608199 91019553
78087433 -61515160
-93465529 27267558
13655649 -92011700
-4844144 -90101777
-76856347 -55299593
7037669 95820739
73512631 -55423174
66171160 -69809341
-38015506 -91878674
92573512 18160315
-89558982 43574979
41250811 89067345
90892069 312...

output:

45035187.388427297359158
45009163.606522198890161
45033436.393176984118327
45019451.023972660663276
45022200.750439712795924
45014848.458434379768732
45024066.216821860849450
45004916.909057567987475
45009051.615713048697216
45011633.811925002199132
45006265.908687957242364
45025389.777399252208852
...

result:

ok 100000 numbers

Test #24:

score: 0
Accepted
time: 665ms
memory: 16452kb

input:

100000
73858871 59646768
74771059 50581404
69886208 66567485
-98824001 3209940
71195346 65729342
-31147238 89170502
-93247841 -18314860
25371727 94636356
96922565 192144
11319923 -96984253
-90534277 -37798172
92579912 22026541
-85805605 34201581
-34434706 84998535
28174675 -86301411
18885420 9491316...

output:

45004913.366417094424833
45049419.116045768096228
45013923.512968818547961
45018139.648850551257055
45036905.812736864674662
45014915.926184665160690
45021998.416493697070109
45005546.419051039520127
45013393.318740322050871
45031474.261754722079786
45023802.290251977061416
45024466.482173579617665
...

result:

ok 100000 numbers

Test #25:

score: 0
Accepted
time: 663ms
memory: 16456kb

input:

100000
6192364 97854354
-26396072 -87670473
-15829494 95984810
29977494 -87073709
85322761 44933323
-10724758 96451337
25075242 -88807937
88653656 -28596396
-7234959 97007100
-98015205 5615321
-46753278 -86423176
-84626507 -46187913
58215823 -70504834
88062585 26935126
79507695 56070039
-81885399 -4...

output:

45007894.835661143642938
45013616.113562520058622
45048543.606146209564031
45027729.033064782019210
45013317.498519366192340
45020005.920267862293258
45013214.453261519392981
45017977.192825323061697
45015065.221386670240463
45019880.166149295491778
45029719.358501169543160
45018055.142010960935295
...

result:

ok 100000 numbers

Test #26:

score: 0
Accepted
time: 693ms
memory: 15440kb

input:

100000
-56925997 -77019489
93686323 23015852
-96967479 14925388
-69298767 71247873
-89975226 -39629378
-81202105 -57862266
-30611438 -91102049
69779237 60415278
85454036 38912399
-23494246 -94997385
11333990 -97239874
26776076 95709458
7400584 -95188065
94132228 33609835
31334391 -91724795
15440367 ...

output:

45031230.008361932999833
45031012.683754624173162
45051159.926753292387730
45057523.943900600497727
45021248.938393512878974
45034531.522257291420829
45010861.904401679275907
45036940.666258362281951
45011332.887303712261200
45014214.383354422363482
45031679.228282402473269
45012785.367206319067918
...

result:

ok 100000 numbers

Test #27:

score: 0
Accepted
time: 709ms
memory: 16424kb

input:

100000
86473583 -50222687
87983523 47527871
50172327 -86502810
-50052528 -86572186
-81465580 57994464
99757942 6953600
-89115446 45369999
-98572877 16834073
86724085 -49788872
-72244940 -69142374
95384011 -30031466
31730815 -94832244
-96383253 26650854
70233115 71185027
38343247 92356888
-76013019 6...

output:

49999997.457180444493133
49999998.462779391738877
49999997.101283127234638
49999996.866126746284863
49999998.630534022177017
49999998.505083259831736
49999996.210166127777484
49999998.664219631202286
49999997.421962514425104
49999996.609795352935180
49999997.246550287549326
49999997.578450701508700
...

result:

ok 100000 numbers

Test #28:

score: 0
Accepted
time: 709ms
memory: 16152kb

input:

100000
96098382 27660424
96993975 -24334494
98858570 15065921
-70174372 71242940
59401282 80445550
-34968800 -93686616
-45576276 89010123
-93157321 36355368
-98590008 -16733454
29170468 95650836
81074291 -58540220
92315133 -38443648
88517611 -46525596
99591182 -9033025
17031645 -98538935
-76791060 -...

output:

49999997.228158699213964
49999997.302541967354045
49999996.671048084543145
49999996.713219850473251
49999998.739982552637230
50000000.531551659674733
49999998.050688044033450
49999998.960497967804258
49999996.755359210703318
49999997.142460837723775
49999998.772500847786432
49999997.590343524963828
...

result:

ok 100000 numbers

Test #29:

score: 0
Accepted
time: 708ms
memory: 17012kb

input:

100000
98649054 -16381761
-99891340 -4660392
85079131 -52550367
98751502 -15752448
38325930 -92364069
16772724 98583333
75122377 66004758
95139156 30798377
-24102560 97051870
89328512 44949025
-83521481 -54992370
-22923261 97337161
-49154851 87085012
67965351 -73353320
-79586737 60547083
44791227 -8...

output:

49999996.812415128009889
49999996.708892427162937
49999997.657220137371041
49999997.025182525147102
49999997.558449811669561
49999997.967656164932123
49999998.161912660798407
49999996.512054779675964
49999998.454882508693117
49999998.211120407508133
49999998.443388010029594
49999997.046242777068983
...

result:

ok 100000 numbers

Test #30:

score: 0
Accepted
time: 703ms
memory: 15064kb

input:

100000
7197545 -99740639
39789850 91742935
-44563738 -89521349
92588284 -37781069
89874957 43846213
-97082384 23979340
52035210 85395169
87881876 -47715555
-25428031 -96713047
6688701 99776051
31394586 94944081
66622083 -74575443
81096253 -58509804
-98223145 18767345
10583592 -99438356
-97020186 -24...

output:

49999997.024263621879072
49999996.435169794876856
49999997.547266997575207
49999996.418456573974254
49999998.787866344595386
49999997.814842517367651
49999998.120933058176888
49999996.115127751851105
49999996.887268344322365
49999996.110272012840142
49999997.636598197033891
49999998.019836467079585
...

result:

ok 100000 numbers

Test #31:

score: 0
Accepted
time: 692ms
memory: 15832kb

input:

100000
48053189 87697724
-99230647 -12380496
71228034 -70189504
-99862038 -5250874
-92715593 -37467545
26308785 -96477183
91137520 41157649
86371053 50398812
-99541893 -9560913
-96837592 24949526
-28842311 95750301
-99906431 4324846
32704032 -94501032
-98983846 14219579
-98402231 17804504
42162900 9...

output:

49999996.083130863720726
49999996.465537447715178
49999998.443205323506845
49999995.652097869802674
49999998.185253396521148
49999998.414844537415775
49999999.001358132663881
49999997.298474564624485
49999997.185197829101526
49999999.048871860093641
49999997.264306866360130
49999996.618167474342044
...

result:

ok 100000 numbers

Test #32:

score: 0
Accepted
time: 703ms
memory: 16232kb

input:

100000
-23951830 97020265
-79900659 60056128
-83964098 54143803
97074821 23809857
61007903 79212713
-45094976 89223718
-89377964 44681664
-98513176 -17056240
-27426886 -96062608
56189487 82666265
18047227 -98345883
-99936265 1286532
18608822 98231586
-56949101 82157764
99503767 -8898358
52721687 -84...

output:

49951674.187935857193224
49951419.310247167712077
49951190.602599581172399
49951412.582199406169821
49951643.320136941332748
49952981.540484763710992
49951531.566115579993493
49950744.707859334430395
49951759.674120479936391
49952147.680364154319250
49950940.645670600843005
49951560.394829694952932
...

result:

ok 100000 numbers

Test #33:

score: 0
Accepted
time: 691ms
memory: 16000kb

input:

100000
-82922797 55795521
98806631 15264719
27227855 96151671
90640250 -42064680
97570886 21814297
11561464 99312553
-63044255 -77522636
75253645 65715048
-46471655 -88525692
-74788283 66304581
59047518 -80664807
99509005 9753002
6599999 -99699054
-57520499 -81692754
-94724230 -32037998
-91266303 -4...

output:

49951008.875219689751248
49952120.115177175564895
49951313.897532169634360
49951522.634123654162977
49951493.467322172105924
49951417.899049797208136
49951239.587310292517941
49950786.058449472053326
49951126.619456992204505
49951635.253467245085631
49951599.443553832763428
49952120.260265085278661
...

result:

ok 100000 numbers

Test #34:

score: 0
Accepted
time: 694ms
memory: 16908kb

input:

100000
-94334950 -33002816
94253220 33387641
80851945 -58743434
92068179 38797643
92438296 38143230
87690855 47910947
18278347 98277620
98579284 16519538
87518221 48304789
-71902423 69487747
99868312 3214776
-74106386 67019802
-27751893 -96052705
-91146289 41016721
-98277121 -18367587
60051086 79947...

output:

49951455.312006523345190
49951491.343815442782216
49951164.149655139346578
49951630.073480293762259
49950857.033188459012308
49951496.726094349887717
49950560.274241116279882
49952262.780461999631370
49952389.114619360127108
49950986.994946738668659
49951582.705841209335631
49950722.732104878257815
...

result:

ok 100000 numbers

Test #35:

score: 0
Accepted
time: 710ms
memory: 15264kb

input:

100000
66711064 74461687
-99974135 -2174163
-1056958 99918825
-36812938 92895057
40400128 -91384257
15553026 -98744225
51376353 85721836
98739904 -15613787
-99973461 1404943
14291417 -98963322
98599204 16637582
-92316397 -38311014
-51618501 -85635835
-36591459 -93015393
-91664061 -39878690
99771335 ...

output:

49950743.725416390305327
49952335.520617832560674
49951444.885271386108798
49951226.690448581073724
49951463.962362871516234
49951443.564873015660851
49952105.389257130616897
49951524.821994931582594
49951689.489781439715443
49951151.856495621457725
49951874.812591819321824
49951645.976862155592244
...

result:

ok 100000 numbers

Test #36:

score: 0
Accepted
time: 712ms
memory: 16756kb

input:

100000
-50274904 86430058
-30033231 -95322369
-98405889 17641407
-61672858 78646085
26241959 96398065
4426523 99837644
-99019995 -13814286
99913840 681111
90361534 -42631803
87161706 48939878
-95813074 28347212
-40705166 91264788
98666969 16193024
85025293 52491476
-3692790 -99876257
-73433772 -6783...

output:

49951659.988507896599913
49950981.320960780529276
49951893.006918853108800
49952278.516171838415175
49951380.704554173204087
49950845.512963435048732
49951575.773034056197503
49951240.964880166946386
49951205.748827726180025
49951032.151731032306998
49951732.078858421831683
49951938.718500896422483
...

result:

ok 100000 numbers

Test #37:

score: 0
Accepted
time: 685ms
memory: 19124kb

input:

100000
-3329385 99331174
-70604294 70669786
-87081417 -47338605
67572485 73507498
-94011626 -33780311
-11304772 98491936
40610638 90325570
-59981987 -78948235
-25072291 -96778665
97190682 -18875941
73326816 67610572
71253553 69607148
63274218 -76228295
40643832 91311687
31058993 94112669
96614227 -2...

output:

49504623.193857595590089
49506835.240818481008318
49505169.580401228387927
49508592.121229167158162
49509011.121833293302188
49505380.637326685882726
49504969.034702767086856
49503721.112644707834988
49502895.114238695063250
49508793.791913766588550
49505050.243074044927198
49506657.712153675962327
...

result:

ok 100000 numbers

Test #38:

score: 0
Accepted
time: 692ms
memory: 17344kb

input:

100000
-88188547 -45804127
35518984 -92836002
84909347 -52102417
-78092577 -61565961
53608303 -83757017
-43358191 -89594529
-99733872 -5307764
51833620 84616172
-58956000 80333018
-44663911 -88660327
39476608 -90966406
98023033 -15767254
-92649608 36189499
-20044268 -97062782
75271019 -64531120
1305...

output:

49505594.923675933230697
49509390.140075661634910
49506149.089978109434014
49510170.092745813970396
49503968.555283042438532
49506197.332630528268055
49507042.641109848234919
49505615.640017860594526
49510195.100103128290357
49506434.974062813540513
49507114.542764313275256
49507814.927876700650813
...

result:

ok 100000 numbers

Test #39:

score: 0
Accepted
time: 696ms
memory: 21132kb

input:

100000
-99782597 -3415872
-61105726 79084288
30912116 -94584503
26277091 95534616
-99475895 -2777059
25739063 95981962
-29397062 94756672
13419054 -98397843
75908620 65036189
-95649393 -29121947
-99476677 -4608633
-44872944 89131709
58443026 -80934109
-80216834 -58992281
-99642474 -4043864
-93282892...

output:

49507920.830202802870190
49503935.873500387646345
49504166.447233175033034
49506478.456392936870543
49506103.946617215911829
49506818.789411791578459
49505185.277385782152123
49507164.500468727339467
49507676.947849000389397
49506327.970542678671336
49505482.630619675393973
49507856.906126285448408
...

result:

ok 100000 numbers

Test #40:

score: 0
Accepted
time: 687ms
memory: 15380kb

input:

100000
-36117371 92618778
-73335258 -67061989
-80911383 57489284
89176933 -43555438
-44254978 89569042
-86787265 -48709508
-97251076 20319527
11571957 99298949
70511170 -69837542
-99634170 482767
96836213 22314925
92257812 36998150
55392610 -82618881
64718586 75192210
-33320217 93286849
71138573 702...

output:

49507470.510252021733322
49504173.744960466730845
49508449.727610055018886
49507818.319997009493818
49503991.586841841501155
49507051.085281331295846
49507825.011092400254711
49507882.639774117946217
49509928.861281217748910
49503373.493066773480678
49504658.525326807503006
49507126.800513571120973
...

result:

ok 100000 numbers

Test #41:

score: 0
Accepted
time: 927ms
memory: 15940kb

input:

100000
-19955231 -97699535
94825749 -28990747
-79907148 -59107167
-99027556 1423520
37739298 -92055126
84889533 -52160862
-68994023 71800045
-78602361 61152977
-41135006 -90230500
-18711359 -97257627
66663581 74134831
-37980361 -92135750
-2196230 -99805345
61435279 78416798
99254865 5765553
9861983 ...

output:

49509084.955278959529096
49509044.558948848662112
49508051.397699699828081
49506403.093743864134012
49509646.005820662550832
49510964.901052008848637
49504435.062907647374232
49503658.372490269102855
49508600.593410942954506
49508992.980827568797395
49506743.698676641033671
49503939.703590090975922
...

result:

ok 100000 numbers

Test #42:

score: 0
Accepted
time: 658ms
memory: 16296kb

input:

100000
92556374 12072350
93766905 4825190
-67271877 69890083
73298299 55897595
-31299356 -93814485
-80498315 54176779
-31345062 -88453539
83029787 -49705175
-80101942 -52307613
-69888580 -56945797
-85803388 38619155
63351605 70575401
93281896 22216160
-97847849 -20164083
76241863 52328510
-95583679 ...

output:

45013832.107668465003371
45018190.691538632789161
45016655.106545677532267
45020233.085753879891854
45026293.803795845458808
45061276.320533562196943
45038673.057249006666098
45026156.257588257780299
45013595.743077687318873
45025686.795972830561368
45037303.271623864889989
45028239.028974648586882
...

result:

ok 100000 numbers

Test #43:

score: 0
Accepted
time: 652ms
memory: 15240kb

input:

100000
-32081572 90116995
-73229798 -64672076
91131427 5196295
10394383 -94678607
99786071 639864
-92342810 -852711
-84391341 -47449093
-74420874 64181438
-51777172 -78771868
-76271622 48551648
89768757 12110773
-67381897 -60367678
74807369 -64148569
48356402 -76298700
-1187892 -93943444
-93924469 -...

output:

45043971.667201755102724
45037044.323782083469268
45039953.525893988728058
45049333.132307396605029
45029998.005494937006006
45024418.348786424430727
45033727.938979693150031
45040087.414792593906895
45027614.906723909170978
45044037.799188363558642
45021590.284720920244581
45032495.268230428606330
...

result:

ok 100000 numbers

Test #44:

score: 0
Accepted
time: 663ms
memory: 15244kb

input:

100000
9559919 92659433
51875371 83680106
78642333 -59484990
-67562834 73384342
-50641362 -85443942
94239770 18902122
-63150344 66462007
93871387 -2488444
-78837743 43705750
-18631355 94166502
-21600045 -92649401
96280408 -20960957
-26104161 87813365
-16304015 -96036171
-66451374 73268709
-535780 -9...

output:

45035085.128576722821890
45032579.541952972431318
45039705.676485483694705
45027911.269846999923175
45032692.040288372401847
45040422.185502669275593
45026712.861848732081853
45031226.494740348218329
45015448.092764265828009
45020328.563366840604431
45038180.403777773542970
45031725.332495796898002
...

result:

ok 100000 numbers

Test #45:

score: 0
Accepted
time: 663ms
memory: 16432kb

input:

100000
63951077 -71761548
73763706 64396798
21419213 95263455
-68397093 68002102
-62901958 67448916
56595081 -71927093
-85235758 37748571
-63653511 75097403
-68746842 61306045
13699376 92719471
-39604640 -84729019
30466785 90338708
-89960990 10977635
65876081 -64868424
-42437656 -83596792
-68055453 ...

output:

45024619.457457524611527
45022447.012779896551365
45022571.261721487160685
45022725.319423209726665
45017987.746151763229136
45021932.505070402057754
45035073.100826264144416
45020086.948445683450700
45017427.078949186470709
45014614.008942648586526
45023853.368552828498650
45040989.607109763113840
...

result:

ok 100000 numbers

Test #46:

score: 0
Accepted
time: 702ms
memory: 16972kb

input:

100000
-15226924 97699217
-88190354 29200235
-82332756 49054626
92982578 -33157210
59227929 -73138724
38249741 91550174
-51100484 82504881
-96377839 -15349299
36198347 91856588
-90519618 31198671
16179809 -91684442
42535161 -83090574
-70289671 63418188
70901869 -63653069
-71694352 67433238
-8028358 ...

output:

45038361.408514207065309
45025634.895946388969605
45036750.180442335531552
45030721.829083912311035
45024194.549808392963314
45040922.880191702013690
45032333.112598115701985
45038384.817109426534444
45031476.976293529191025
45032198.663195813089260
45038419.137638448955840
45037035.019192961597582
...

result:

ok 100000 numbers

Test #47:

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

input:

200
40 51
52 66
16 -57
25 -86
-68 -21
-77 -23
67 39
62 36
-70 -59
-41 -34
-20 70
-22 77
-16 -82
-19 -95
-77 24
-73 23
-84 46
-78 43
-12 55
-20 93
52 -52
47 -47
-76 18
-76 18
-42 25
-76 45
78 -13
62 -10
86 -37
66 -28
44 60
58 80
-58 -25
-62 -27
-52 82
-36 57
84 13
85 13
-93 13
-49 7
-37 87
-22 52
-52...

output:

25.098044966513973
27.680769497662549
35.161297280980025
33.405187984698513
26.191026160538899
25.762701600125318
29.212262667833041
27.989889823960286
27.236753288240818
25.870068560028382
26.563719717934022
24.838749747011141
25.173359579139786
27.880328702954904
26.406101012611172
30.434655841839...

result:

ok 100 numbers

Test #48:

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

input:

203
82 0
66 0
85 0
-38 45
-57 68
-1 71
-1 80
73 25
68 23
-18 90
-10 52
45 57
50 63
-39 74
-45 85
19 78
18 74
31 91
28 85
36 43
61 73
-58 44
-53 40
16 77
16 77
16 47
29 83
-73 30
-58 23
-82 44
-63 34
65 36
86 48
-4 63
-4 67
50 83
35 58
84 14
85 14
15 92
8 49
54 77
32 46
-26 85
-29 95
67 60
74 66
89 4...

output:

25.408463178146360
59.285265589768447
36.614957288752526
25.635765960910125
25.192790760472440
29.935112111589204
27.586723826980018
25.462485682472777
43.109717513318645
24.871616470864671
150.991087047443284
27.877013988338017
28.522736856128802
25.063033333109227
24.968705197430815
25.11952668430...

result:

ok 100 numbers

Test #49:

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

input:

500
-55 23
-64 27
-61 26
-56 23
-92 38
-90 39
-81 35
-48 21
-73 31
-45 19
-1 -53
-1 -68
-1 -68
-1 -85
-1 -88
33 -59
35 -62
25 -45
31 -55
32 -57
-1 70
-1 92
0 51
-1 69
0 54
0 -72
0 -94
0 -49
0 -56
0 -49
79 -40
73 -38
44 -22
44 -22
50 -26
-64 45
-50 35
-40 28
-54 38
-63 45
-70 25
-67 24
-64 22
-89 31
...

output:

24.816043440887870
25.217191414203533
25.644283017552828
24.707426304214623
25.424482166553397
24.986497052686843
25.193483730145636
25.142405014825128
24.663265306122449
25.940302590505083
24.654906638144167
26.104731921043994
25.036149013457483
26.109852100908231
25.250000000000000
25.962405577965...

result:

ok 100 numbers

Test #50:

score: 0
Accepted
time: 4ms
memory: 3960kb

input:

503
57 0
60 0
70 0
48 36
79 60
74 56
78 59
70 53
-36 71
-22 44
-39 75
-24 47
-31 61
-75 41
-77 43
-78 43
-59 33
-62 35
-47 43
-48 44
-44 40
-52 47
-68 62
57 39
45 30
78 53
60 41
78 53
-6 56
-5 49
-9 80
-10 88
-9 82
-19 46
-22 52
-27 65
-30 72
-24 57
54 38
63 44
59 41
61 42
59 41
74 58
69 54
42 33
58...

output:

262.718480507177112
24.942333811718152
25.400077466799874
35.645590352484167
25.678526671179059
24.888910084665746
97.530335387747555
40.860941401078833
104.969620060355820
24.646275610860975
30.447856601859992
25.179852823959087
25.224523964424661
24.646275610860975
24.732904328393894
25.2963028725...

result:

ok 100 numbers

Test #51:

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

input:

1000
35 76
32 70
29 63
29 64
33 72
34 74
32 70
35 76
40 89
41 90
14 89
10 66
12 72
12 76
12 72
12 72
9 54
9 59
11 68
12 76
-35 75
-39 83
-39 84
-21 45
-22 46
-26 56
-37 79
-24 52
-26 56
-23 49
80 -14
66 -11
98 -17
73 -12
94 -16
93 -16
60 -10
73 -12
97 -16
95 -16
23 -46
41 -82
27 -54
26 -52
34 -67
24...

output:

24.870289505888166
25.101565339699277
24.933600347877160
25.223793282914495
24.663809863236643
25.529668094030517
24.688488237613768
24.886039736112598
24.985976289683059
25.129834035992142
24.824620021264564
25.126290915291512
25.649018457206411
25.203791674880131
25.023039766136390
24.696269238542...

result:

ok 100 numbers

Test #52:

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

input:

1003
62 0
84 0
78 0
69 13
78 15
80 15
76 14
82 15
96 18
98 19
53 10
89 17
65 12
-19 75
-18 71
-18 71
-13 53
-14 58
-17 66
-19 75
-19 75
-20 80
-22 89
-44 22
-46 23
-55 27
-78 39
-51 25
-55 27
-49 24
-53 26
-73 36
-59 29
-50 55
-64 70
-63 70
-41 45
-50 55
-66 73
-65 71
-34 37
-35 38
-61 68
-52 27
-67...

output:

24.691613227908842
44.668862997880299
24.535029443019992
24.549829088955943
59.812811233842809
24.597119032568238
24.682005366033143
24.523481939201118
24.617292519515602
53.181645514698546
24.527029493411689
25.179693734870759
25.139444464862838
29.631228988478286
24.767389862224428
25.357555336634...

result:

ok 100 numbers

Test #53:

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

input:

200
9 93
5 51
-53 -17
-93 -30
-55 -30
-52 -29
91 -15
88 -15
56 -49
41 -36
14 -87
11 -65
60 51
73 62
-58 -25
-87 -37
-70 2
-96 3
38 -49
52 -68
74 42
56 32
-72 -19
-93 -25
-18 -50
-29 -83
1 -91
0 -81
84 -29
51 -18
-63 64
-42 43
-7 49
-9 57
45 29
46 29
33 -41
37 -46
92 -35
92 -35
23 86
17 63
75 -20
83 ...

output:

28.863216935034164
29.578879053943006
26.783368629135551
26.893147297774638
26.703069170519942
28.081818181818182
30.607735216390943
26.956976164356817
27.762920219557216
27.973037062593879
28.860087313337158
29.369702080787033
26.605636303158433
31.287133357201060
27.671655870367408
27.233771856980...

result:

ok 100 numbers

Test #54:

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

input:

203
90 0
94 0
52 0
-1 55
-3 97
-7 62
-6 59
-86 35
-83 33
-60 44
-44 32
-53 70
-39 52
72 31
89 38
-4 63
-6 94
8 70
11 96
-47 41
-65 56
81 27
61 20
0 74
0 96
-22 49
-36 81
-50 76
-44 68
-79 39
-49 24
39 80
26 54
32 37
38 43
50 18
51 18
-40 34
-45 38
-88 45
-88 45
70 55
51 40
-71 32
-78 35
-30 52
-30 5...

output:

27.008146270318934
28.676470588235294
28.240000000000000
27.781120435905048
27.963796757255121
161.524923985830184
28.600000000000000
26.856098003991570
61.159245925888017
-1
28.798381161385214
26.570797868064487
2844.420944388460174
29.454784383073068
26.215969391376845
25.820042242213263
25.680687...

result:

ok 100 numbers

Test #55:

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

input:

500
-62 -10
-87 -14
-59 -9
-56 -9
-58 -9
-88 17
-66 13
-68 13
-68 13
-65 13
86 10
95 11
57 7
51 6
72 8
10 63
11 71
11 70
11 71
12 81
-44 83
-23 44
-32 61
-35 67
-44 83
81 -22
65 -17
76 -20
76 -20
88 -24
25 90
22 79
23 82
17 59
14 49
-85 51
-60 36
-59 36
-70 42
-57 34
48 71
34 51
43 64
29 43
42 62
60...

output:

26.859374526036584
26.470866011614435
26.042125925225990
25.207916305788087
28.237054983177126
27.118919937137594
26.777701732562399
26.649627824387568
27.438470718340536
25.579796974555183
25.275590994053974
25.255698117039860
27.022132103550900
26.421659083001796
25.557881537270403
27.283304386104...

result:

ok 100 numbers

Test #56:

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

input:

503
66 0
63 0
89 0
-51 23
-53 24
-53 24
-81 37
-61 28
-12 68
-11 65
-16 91
-15 85
-16 94
17 48
24 68
19 53
21 60
24 67
-65 30
-75 34
-82 37
-86 39
-45 20
-41 63
-52 79
-47 72
-46 71
-37 56
-25 74
-29 86
-25 73
-30 88
-27 78
12 60
10 49
18 92
20 97
14 69
28 76
23 62
17 47
29 80
21 58
-47 21
-68 31
-6...

output:

29.198381595171928
25.414624176984126
222.738636073762470
31.089999696561426
53.659634507973452
26.077744175594831
-1
62.362538779965632
25.350164508970449
25.110671427617410
26.383860814561683
26.939412212357587
30.241216698897597
28.869084861280038
25.919315106880437
24.678621419614306
31.21375224...

result:

ok 100 numbers

Test #57:

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

input:

1000
-8 60
-12 96
-8 61
-8 66
-11 87
-9 69
-9 68
-8 62
-8 62
-8 63
-17 70
-17 71
-12 48
-22 91
-22 88
-14 57
-24 97
-13 54
-16 66
-17 68
44 23
62 32
81 42
51 26
61 31
59 31
68 35
66 34
66 34
47 25
50 16
55 18
91 30
51 17
90 30
76 25
69 23
64 21
66 22
63 21
-94 21
-55 12
-74 16
-86 19
-85 19
-93 21
-...

output:

25.380132640725846
25.969324461492540
25.868975242039355
25.798476235321486
26.442505736978380
25.355325310155226
24.679221713836211
24.924529980883859
25.104296256799680
25.764927138661249
25.610276149775529
24.763489348346393
26.397544792580419
25.940148262972894
25.380257805580064
25.665405794850...

result:

ok 100 numbers

Test #58:

score: 0
Accepted
time: 4ms
memory: 4036kb

input:

1003
70 0
61 0
97 0
-42 52
-55 68
-44 54
-43 53
-39 48
-39 48
-40 49
-45 56
-45 56
-46 57
-88 30
-86 29
-55 19
-94 32
-53 18
-65 22
-67 22
-81 27
-47 16
-67 22
27 50
33 60
32 58
37 67
36 65
36 65
26 47
29 53
25 46
28 51
50 18
89 32
76 27
68 24
63 23
65 23
62 22
80 29
91 33
53 19
-41 78
-40 78
-44 85...

output:

124.246603701142866
25.165507779682215
25.048752537354925
30.296413164922313
64.848456154522291
24.785140991466892
30.848646730289216
48.255999774659845
61.338218578371224
119.762733122194398
-1
48.114671943594581
25.360000000000000
25.101227115876459
32.442403975253256
26.005653317934547
24.8246345...

result:

ok 100 numbers

Test #59:

score: 0
Accepted
time: 669ms
memory: 15296kb

input:

100000
41594617 -90874202
41616553 -90922126
41579076 -90840249
41587678 -90859042
41603508 -90893628
41611148 -90910318
41610867 -90909704
41585149 -90853518
41611061 -90910128
41600233 -90886472
-41392157 90946563
-41394053 90950728
-41405020 90974825
-41387761 90936902
-41423060 91014461
-4141407...

output:

49952220.580772524779604
49951771.677044926214876
49951371.989336008686223
49951722.453087780711940
49951600.624123204783245
49951055.410979038566438
49951961.641274336616334
49951445.774475544181769
49951409.281114821395022
49951768.237373654828843
49951956.181335682678764
49950601.875695524784533
...

result:

ok 100000 numbers

Test #60:

score: 0
Accepted
time: 612ms
memory: 17628kb

input:

99993
99923917 0
99924571 0
99937757 0
-23163715 97243691
-23162127 97237022
-23153610 97201267
-23162718 97239503
-23151418 97192067
-23157394 97217155
-23162408 97238202
-23153027 97198819
-23160206 97228957
-23166709 97256258
-27227991 96159791
-27243429 96214310
-27237920 96194854
-27225082 9614...

output:

49950676.487489533898042
104318412.758658543083584
82053691.177591666302760
49950848.495995514123933
-1
62823858.088781819104042
49951164.228236184069829
50952144.129940047638229
49950710.175245110858668
2562289954.443670879350975
87290985.055272101599257
49950530.326459502441139
-1
53452189.1339143...

result:

ok 100000 numbers

Test #61:

score: 0
Accepted
time: 681ms
memory: 15312kb

input:

100000
17236606 98488167
17233116 98468222
17228331 98440886
17232758 98466177
17231878 98461152
17231411 98458482
17222609 98408189
17235073 98479406
17225005 98421879
17233979 98473157
66868196 -74259692
66872083 -74264009
66886995 -74280569
66874697 -74266911
66881412 -74274369
66859821 -74250392...

output:

49950400.583931979930639
49951113.103380628868763
49952554.332727121134667
49951016.622504462884535
49951981.646743711284216
49951323.689130714785279
49951016.735680298297666
49952086.302699889016367
49950219.591924319971440
49951676.987169490428641
49951340.994069594111352
49950491.038867118382768
...

result:

ok 100000 numbers

Test #62:

score: 0
Accepted
time: 601ms
memory: 17720kb

input:

99993
99972481 0
99935818 0
99941457 0
95115106 30556139
95193853 30581437
95202874 30584335
95192329 30580947
95147223 30566457
95183244 30578028
95182967 30577939
95190044 30580213
95188511 30579720
95162235 30571279
34715168 93756807
34705128 93729691
34720761 93771913
34700598 93717457
34699848 ...

output:

49950344.363696269534557
50383244.898058841903548
49950240.007263339099154
49950656.469462909226422
49950335.715059377627767
92431763.693795148006757
51224242.329575650597690
49950631.146217590412562
484250533.063274750427809
49950493.731651427402539
49950237.974946608141181
62215523.357795462117792...

result:

ok 100000 numbers

Test #63:

score: 0
Accepted
time: 656ms
memory: 17300kb

input:

100000
12687496 -91994997
12824312 -92987026
13317803 -96565251
13299688 -96433902
12720209 -92232193
13542850 -98197029
13074398 -94800361
12545291 -90963892
13229962 -95928329
12969350 -94038672
-48673482 84982797
-45021449 78606431
-45441747 79340261
-46482111 81156714
-49368630 86196511
-4759406...

output:

45050534.977592435890983
45031402.740540731982037
45058668.019766516015807
45033346.367483102825645
45030976.481731257732463
45016979.979698861567158
45028401.881062344687962
45021884.537709950345743
45028879.986663701176440
45040530.216317622536735
45040983.553084304992808
45031232.277802501390397
...

result:

ok 100000 numbers

Test #64:

score: 0
Accepted
time: 607ms
memory: 16920kb

input:

99993
95502024 0
91716495 0
93035290 0
72077807 60990245
73843982 62484734
71147783 60203284
70213842 59413009
76122586 64412825
75950793 64267459
70790432 59900904
70968931 60051945
74087858 62691094
74591423 63117197
-60476742 71946579
-62742047 74641515
-58551774 69656528
-63266536 75265477
-5829...

output:

65733201.070742050658737
45023455.696542306246556
45014395.900170038825308
47149047.455727137075883
45014289.178160675783147
45018390.339081940368487
55468012.096247496097931
54515884.321591870073462
69269766.593720413300616
65741869.337800312856416
45011260.752151398533897
45013931.826611500520812
...

result:

ok 100000 numbers

Test #65:

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

input:

100000
42239570 84097913
40467871 80570506
44226575 88053991
40847944 81327222
40619575 80872544
44389877 88379120
42783412 85180690
40891805 81414547
42268186 84154887
41491942 82609406
73479752 -67728993
69659672 -64207884
70858995 -65313344
71508900 -65912386
69056997 -63652376
71008080 -65450762...

output:

45013524.064021052872704
45020398.765600050759531
45019955.647192602769792
45008672.192162514456868
45017581.566566533878358
45010581.733977211621095
45013856.751487210189225
45012629.019147929982864
45016784.974640340846236
45011523.287857537463424
45026949.663417993255280
45026007.764779769782763
...

result:

ok 100000 numbers

Test #66:

score: 0
Accepted
time: 623ms
memory: 17032kb

input:

99993
96817884 0
92960446 0
94106286 0
-33154491 86737124
-33608115 87923875
-33196444 86846880
-32705929 85563620
-33550638 87773506
-34572794 90447619
-34019689 89000613
-33108878 86617795
-35297179 92342720
-34664558 90687688
-6326254 92273893
-6316622 92133389
-6606001 96354241
-6694254 97641488...

output:

45025599.060163105914398
45010203.092717646220990
45016437.309348276030505
45006467.855014058506640
131742656.772502750864078
46980361.829354360612342
80973529.243291287952161
52921873.466658344543248
45011842.884378828388435
68504825.061614016442036
45018861.051519346270652
59853174.155796347127762...

result:

ok 100000 numbers

Test #67:

score: 0
Accepted
time: 640ms
memory: 16536kb

input:

100000
-54553504 -83466397
-53217438 -81422228
-51401674 -78644124
-53757138 -82247964
-53403130 -81706335
-54001247 -82621449
-51670298 -79055116
-54267073 -83028160
-51905316 -79414692
-52078219 -79679232
-52023670 -79595772
-50932231 -77925880
-53690814 -82146489
-54567725 -83488155
-51286909 -78...

output:

45049274.760877826593060
45035096.853795735616586
45026791.045417099867336
45029899.283355176958139
45029865.289479043578467
45044294.770169117487967
45015654.418194581066928
45041224.684706093161367
45033658.782396646445704
45015206.286653658171417
45032305.897229653612158
45041809.507590387922392
...

result:

ok 100000 numbers

Test #68:

score: 0
Accepted
time: 588ms
memory: 17356kb

input:

99903
94448229 0
90761763 0
97985588 0
89901191 14452033
97883093 15735161
90118625 14486987
95578572 15364698
94701726 15223741
98448883 15826114
92212912 14823653
94215840 15145633
95077988 15284227
91419317 14696079
91425707 14697106
90844976 14603751
98587220 15848352
97841999 15728555
91363965 ...

output:

45011299.743254285232979
134372110.054220104721026
45014323.934748463569122
45013925.573213453037170
45199650.706937787370407
47433053.851743689130672
-1
179514912.477360350181698
45024826.596842337239650
45018053.668354187662771
45013564.314794615078426
45020087.081214572626777
45023353.36425106834...

result:

ok 100000 numbers

Test #69:

score: 0
Accepted
time: 656ms
memory: 16336kb

input:

100000
88804287 36439715
86562171 35519691
87659885 35970124
89457475 36707742
83298350 34180423
91106060 37384218
91620802 37595437
90862639 37284334
85069690 34907271
85764475 35192367
92170179 37820866
87796542 36026200
85616339 35131581
87350464 35843157
90172873 37001297
89474600 36714770
90840...

output:

45025630.733884692428546
45016999.140790164714417
45020400.728333645016392
45037891.734236065381992
45045272.801003882290388
45009662.072025220939395
45038911.438161076592223
45024442.048851721941901
45021030.946809468950960
45043493.962665210168780
45031010.470678656129166
45017259.896851999485079
...

result:

ok 100000 numbers

Test #70:

score: 0
Accepted
time: 600ms
memory: 15324kb

input:

99903
95572601 0
92262610 0
94280776 0
17594269 97925670
17071048 95013545
16101053 89614772
16162408 89956264
16801040 93510741
17116697 95267616
16966675 94432627
15954553 88799389
17348696 96558871
17153395 95471867
16358027 91045032
16040142 89275758
17578486 97837828
16743413 93190002
17196216 ...

output:

78834094.036186495795846
45349195.050164038082585
45171861.502576937320555
48480891.222024613703979
45009700.996292385771085
45055519.303875235647865
53401156.279811353761033
45007886.011859966722113
45002321.030887827091647
237333132.983836283514393
45004216.437863952291082
45016230.697455780136806...

result:

ok 100000 numbers

Test #71:

score: 0
Accepted
time: 638ms
memory: 21032kb

input:

100000
90980678 90980678
-90980678 90980678
90980678 -90980678
-90980678 -90980678
90980678 56516627
-39032083 90980678
-90980678 -67650282
90980678 77163629
57789179 90980678
-90980678 -60740012
-90980678 -46397517
25299242 90980678
-1387583 -90980678
9324008 -90980678
-90980678 47716991
90980678 -...

output:

45454659.883025141109101
52267721.094933273077913
47567301.416559898683772
45835920.489206203357753
45281217.332067032904888
49497507.440307358403516
51087067.397203592416190
47211961.466947267846990
49979164.301109842297592
47194779.257150164623454
50877841.026050300868519
45886964.413484759163111
...

result:

ok 100000 numbers

Test #72:

score: 0
Accepted
time: 658ms
memory: 17628kb

input:

100000
90964825 90964825
-90964825 90964825
90964825 -90964825
-90964825 -90964825
66922048 -90964825
-3433934 -90964825
90964825 -65962488
-35699201 -90964825
-64781820 -90964825
-68303343 -90964825
-90964825 -11834307
-90964825 -75592444
61554274 90964825
-90964825 -65419756
-90964825 -83227577
-2...

output:

52506632.941170895268442
48917742.243320244157076
45730847.984404561819247
46625710.253879357547703
45894715.530242157008615
46243303.918477409606567
46323847.825102885559318
51857953.710628628330596
50701807.760221004285995
53111418.421591648489994
53185499.027362434819224
49541798.436813755630283
...

result:

ok 100000 numbers

Test #73:

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

input:

100
94620051 94620051
-94620051 94620051
94620051 -94620051
-94620051 -94620051
19629451 -94620051
39482667 -94620051
80264366 94620051
73728319 -94620051
94620051 -8757638
-94620051 48404092
97294526 97294526
-97294526 97294526
97294526 -97294526
-97294526 -97294526
74085262 -97294526
97294526 5339...

output:

57058690.587358376476914
58750526.717077109788079
53921471.611411830883299
48054800.063851797043753
51388953.772617416972935
53049592.948773724521743
50255976.685661144067126
51611646.521684447161533
49085978.903077390750695
49986287.603401539810875
57564532.493676397603849
53389743.106916548269510
...

result:

ok 100000 numbers

Test #74:

score: 0
Accepted
time: 422ms
memory: 3952kb

input:

100
96939842 96939842
-96939842 96939842
96939842 -96939842
-96939842 -96939842
96939842 9467761
72127104 -96939842
-90892367 -96939842
92642617 96939842
-96939842 -3094298
82157644 -96939842
98980503 98980503
-98980503 98980503
98980503 -98980503
-98980503 -98980503
98980503 29737792
40467990 -9898...

output:

59832159.836583980351861
56789627.042319209595007
58605753.920086728918250
56241909.255372417512262
58403522.063722951930686
49867276.607074779141840
53771735.383291958361951
60878114.612046178644960
65403126.551614545078337
60385174.316950735672435
52834342.717939185335126
56640040.624499023771932
...

result:

ok 100000 numbers

Test #75:

score: 0
Accepted
time: 550ms
memory: 4560kb

input:

10000
98738384 98738384
-98738384 98738384
98738384 -98738384
-98738384 -98738384
98738384 -22669726
98738384 -57747390
54319739 98738384
-12312798 -98738384
-45545728 -98738384
-98738384 901349
99911171 99911171
-99911171 99911171
99911171 -99911171
-99911171 -99911171
74948172 -99911171
-99911171 ...

output:

49188554.571654970208328
46958060.014350605219079
45863802.949365371357999
50306854.021001384444389
46668429.305818309967435
52705395.063166119292873
52873900.934591707729851
52514950.421997522254969
52575642.514952124416595
48850843.511138738878799
48330406.989353925317118
47369837.827659912483796
...

result:

ok 100000 numbers

Test #76:

score: 0
Accepted
time: 544ms
memory: 4420kb

input:

10000
96091308 96091308
-96091308 96091308
96091308 -96091308
-96091308 -96091308
4375227 -96091308
96091308 41088450
-96091308 -26224158
38116835 96091308
17474983 96091308
-96091308 69402616
99261504 99261504
-99261504 99261504
99261504 -99261504
-99261504 -99261504
99261504 -85669909
-92897330 -9...

output:

50724068.382350776522799
46801711.824932895826350
46674376.916471402550087
48909144.521595591268124
52909623.901894725830061
53004479.126340679988061
49661466.419341479035211
49370888.070804439223139
52436940.480075988383760
51923930.950007481042121
45244547.943483479666611
46351287.221695972297312
...

result:

ok 100000 numbers

Test #77:

score: 0
Accepted
time: 271ms
memory: 3640kb

input:

16
92745291 92745291
-92745291 92745291
92745291 -92745291
-92745291 -92745291
-60558247 -92745291
92745291 1929378
-58460896 -92745291
-92745291 -74454813
-59173372 92745291
-48562718 92745291
92745291 -53804670
78260613 92745291
-45079729 -92745291
92745291 42058113
2338714 -92745291
-92745291 -29...

output:

89337940.638303739156981
59140564.841246684693033
60797197.250857011065818
55026722.419923965888302
57981311.246590102109622
67061094.835003619737108
65972052.626902460146084
76743936.909199303860078
81881611.823365128497244
56558247.628664101004688
51620749.449229450623534
56964033.184127173852175
...

result:

ok 100000 numbers

Test #78:

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

input:

16
97696305 97696305
-97696305 97696305
97696305 -97696305
-97696305 -97696305
464073 97696305
-97696305 -18165588
1235320 97696305
97696305 -13186754
-86661002 -97696305
-97696305 -3344870
97696305 -73188922
97696305 86322845
97696305 1731050
97696305 -60730139
15513561 -97696305
65577407 97696305
...

output:

87450330.161220505950041
131341374.793260879378067
96820367.591245838972100
93950109.510599937231746
132387617.005607489474642
92120838.609077973480453
119142888.878657840570668
113821051.096774967278179
90253301.362258190005377
69083337.060249788693909
114587720.462371269211872
126525544.7013264314...

result:

ok 100000 numbers

Test #79:

score: 0
Accepted
time: 522ms
memory: 14476kb

input:

100000
92376819 92376819
-92376819 92376819
92376819 -92376819
-92376819 -92376819
92376819 41805180
-11998303 92376819
21713537 92376819
-92376819 27922339
92376819 -22303293
-41355539 -92376819
76681681 -92376819
92376819 86696920
-83870485 -92376819
29507177 -92376819
92376819 -88244373
92376819 ...

output:

46201653.282018485617300
53697302.135847879635548
46190510.187420280471997
53399882.507102568975824
46785145.680834356000560
46286822.014129861883703
50856242.570560399177339
50476943.109181001218531
46604625.267667228923528
49322963.644801105547231
46334963.062966025212518
50388990.505229959286225
...

result:

ok 100000 numbers

Test #80:

score: 0
Accepted
time: 503ms
memory: 14408kb

input:

100000
94696610 94696610
-94696610 94696610
94696610 -94696610
-94696610 -94696610
-94696610 28267614
-8921868 -94696610
-29418043 -94696610
94696610 -73710923
-94696610 86211805
94696610 -70022012
88724613 94696610
-7661772 94696610
-23421057 94696610
83791803 94696610
94696610 -44484998
83682913 -...

output:

51472469.057259986806457
53935198.373631483740610
54293248.766691056065611
49319138.711718134240073
51092308.109887478804012
54809448.984140195287182
49093868.046160332105501
55364458.947668906464969
52804371.451933966975048
52755587.017012873799104
47422455.403897026822960
47582660.748589709775842
...

result:

ok 100000 numbers