QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#688331#9532. 长野原龙势流星群maspy100 ✓203ms52336kbC++2325.8kb2024-10-30 04:01:202024-10-30 04:01:21

Judging History

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

  • [2024-10-30 04:01:21]
  • 评测
  • 测评结果:100
  • 用时:203ms
  • 内存:52336kb
  • [2024-10-30 04:01:20]
  • 提交

answer

#line 1 "/home/maspy/compro/library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else

// https://codeforces.com/blog/entry/96344
#pragma GCC optimize("Ofast,unroll-loops")
// いまの CF だとこれ入れると動かない?
// #pragma GCC target("avx2,popcnt")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'010'000'000;
template <>
constexpr ll infty<ll> = 2'020'000'000'000'000'000;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * 2'000'000'000'000'000'000;
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); }
int popcnt_mod_2(int x) { return __builtin_parity(x); }
int popcnt_mod_2(u32 x) { return __builtin_parity(x); }
int popcnt_mod_2(ll x) { return __builtin_parityll(x); }
int popcnt_mod_2(u64 x) { return __builtin_parityll(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>
T floor(T a, T b) {
  return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
  return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
  return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

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

#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) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(vc<T> &que) {
  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;
    (check(x) ? ok : ng) = 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;
    (check(x) ? ok : ng) = 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;
}

template <typename T, typename... Vectors>
void concat(vc<T> &first, const Vectors &... others) {
  vc<T> &res = first;
  (res.insert(res.end(), others.begin(), others.end()), ...);
}
#endif
#line 1 "/home/maspy/compro/library/other/io.hpp"
#define FASTIO
#include <unistd.h>

// https://judge.yosupo.jp/submission/21623
namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf
uint32_t pil = 0, pir = 0, por = 0;

struct Pre {
  char num[10000][4];
  constexpr Pre() : num() {
    for (int i = 0; i < 10000; i++) {
      int n = i;
      for (int j = 3; j >= 0; j--) {
        num[i][j] = n % 10 | '0';
        n /= 10;
      }
    }
  }
} constexpr pre;

inline void load() {
  memcpy(ibuf, ibuf + pil, pir - pil);
  pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
  pil = 0;
  if (pir < SZ) ibuf[pir++] = '\n';
}

inline void flush() {
  fwrite(obuf, 1, por, stdout);
  por = 0;
}

void rd(char &c) {
  do {
    if (pil + 1 > pir) load();
    c = ibuf[pil++];
  } while (isspace(c));
}

void rd(string &x) {
  x.clear();
  char c;
  do {
    if (pil + 1 > pir) load();
    c = ibuf[pil++];
  } while (isspace(c));
  do {
    x += c;
    if (pil == pir) load();
    c = ibuf[pil++];
  } while (!isspace(c));
}

template <typename T>
void rd_real(T &x) {
  string s;
  rd(s);
  x = stod(s);
}

template <typename T>
void rd_integer(T &x) {
  if (pil + 100 > pir) load();
  char c;
  do
    c = ibuf[pil++];
  while (c < '-');
  bool minus = 0;
  if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
    if (c == '-') { minus = 1, c = ibuf[pil++]; }
  }
  x = 0;
  while ('0' <= c) { x = x * 10 + (c & 15), c = ibuf[pil++]; }
  if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
    if (minus) x = -x;
  }
}

void rd(int &x) { rd_integer(x); }
void rd(ll &x) { rd_integer(x); }
void rd(i128 &x) { rd_integer(x); }
void rd(u32 &x) { rd_integer(x); }
void rd(u64 &x) { rd_integer(x); }
void rd(u128 &x) { rd_integer(x); }
void rd(double &x) { rd_real(x); }
void rd(long double &x) { rd_real(x); }
void rd(f128 &x) { rd_real(x); }

template <class T, class U>
void rd(pair<T, U> &p) {
  return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T>
void rd_tuple(T &t) {
  if constexpr (N < std::tuple_size<T>::value) {
    auto &x = std::get<N>(t);
    rd(x);
    rd_tuple<N + 1>(t);
  }
}
template <class... T>
void rd(tuple<T...> &tpl) {
  rd_tuple(tpl);
}

template <size_t N = 0, typename T>
void rd(array<T, N> &x) {
  for (auto &d: x) rd(d);
}
template <class T>
void rd(vc<T> &x) {
  for (auto &d: x) rd(d);
}

void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
  rd(h), read(t...);
}

void wt(const char c) {
  if (por == SZ) flush();
  obuf[por++] = c;
}
void wt(const string s) {
  for (char c: s) wt(c);
}
void wt(const char *s) {
  size_t len = strlen(s);
  for (size_t i = 0; i < len; i++) wt(s[i]);
}

template <typename T>
void wt_integer(T x) {
  if (por > SZ - 100) flush();
  if (x < 0) { obuf[por++] = '-', x = -x; }
  int outi;
  for (outi = 96; x >= 10000; outi -= 4) {
    memcpy(out + outi, pre.num[x % 10000], 4);
    x /= 10000;
  }
  if (x >= 1000) {
    memcpy(obuf + por, pre.num[x], 4);
    por += 4;
  } else if (x >= 100) {
    memcpy(obuf + por, pre.num[x] + 1, 3);
    por += 3;
  } else if (x >= 10) {
    int q = (x * 103) >> 10;
    obuf[por] = q | '0';
    obuf[por + 1] = (x - q * 10) | '0';
    por += 2;
  } else
    obuf[por++] = x | '0';
  memcpy(obuf + por, out + outi + 4, 96 - outi);
  por += 96 - outi;
}

template <typename T>
void wt_real(T x) {
  ostringstream oss;
  oss << fixed << setprecision(15) << double(x);
  string s = oss.str();
  wt(s);
}

void wt(int x) { wt_integer(x); }
void wt(ll x) { wt_integer(x); }
void wt(i128 x) { wt_integer(x); }
void wt(u32 x) { wt_integer(x); }
void wt(u64 x) { wt_integer(x); }
void wt(u128 x) { wt_integer(x); }
void wt(double x) { wt_real(x); }
void wt(long double x) { wt_real(x); }
void wt(f128 x) { wt_real(x); }

template <class T, class U>
void wt(const pair<T, U> val) {
  wt(val.first);
  wt(' ');
  wt(val.second);
}
template <size_t N = 0, typename T>
void wt_tuple(const T t) {
  if constexpr (N < std::tuple_size<T>::value) {
    if constexpr (N > 0) { wt(' '); }
    const auto x = std::get<N>(t);
    wt(x);
    wt_tuple<N + 1>(t);
  }
}
template <class... T>
void wt(tuple<T...> tpl) {
  wt_tuple(tpl);
}
template <class T, size_t S>
void wt(const array<T, S> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}
template <class T>
void wt(const vector<T> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}

void print() { wt('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
  wt(head);
  if (sizeof...(Tail)) wt(' ');
  print(forward<Tail>(tail)...);
}

// gcc expansion. called automaticall after main.
void __attribute__((destructor)) _d() { flush(); }
} // namespace fastio
using fastio::read;
using fastio::print;
using fastio::flush;

#if defined(LOCAL)
#define SHOW(...) SHOW_IMPL(__VA_ARGS__, SHOW6, SHOW5, SHOW4, SHOW3, SHOW2, SHOW1)(__VA_ARGS__)
#define SHOW_IMPL(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define SHOW1(x) print(#x, "=", (x)), flush()
#define SHOW2(x, y) print(#x, "=", (x), #y, "=", (y)), flush()
#define SHOW3(x, y, z) print(#x, "=", (x), #y, "=", (y), #z, "=", (z)), flush()
#define SHOW4(x, y, z, w) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w)), flush()
#define SHOW5(x, y, z, w, v) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v)), flush()
#define SHOW6(x, y, z, w, v, u) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v), #u, "=", (u)), flush()
#else
#define SHOW(...)
#endif

#define INT(...)   \
  int __VA_ARGS__; \
  read(__VA_ARGS__)
#define LL(...)   \
  ll __VA_ARGS__; \
  read(__VA_ARGS__)
#define U32(...)   \
  u32 __VA_ARGS__; \
  read(__VA_ARGS__)
#define U64(...)   \
  u64 __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 "/home/maspy/compro/library/graph/tree.hpp"

#line 2 "/home/maspy/compro/library/graph/base.hpp"

template <typename T>
struct Edge {
  int frm, to;
  T cost;
  int id;
};

template <typename T = int, bool directed = false>
struct Graph {
  static constexpr bool is_directed = directed;
  int N, M;
  using cost_type = T;
  using edge_type = Edge<T>;
  vector<edge_type> edges;
  vector<int> indptr;
  vector<edge_type> csr_edges;
  vc<int> vc_deg, vc_indeg, vc_outdeg;
  bool prepared;

  class OutgoingEdges {
  public:
    OutgoingEdges(const Graph* G, int l, int r) : G(G), l(l), r(r) {}

    const edge_type* begin() const {
      if (l == r) { return 0; }
      return &G->csr_edges[l];
    }

    const edge_type* end() const {
      if (l == r) { return 0; }
      return &G->csr_edges[r];
    }

  private:
    const Graph* G;
    int l, r;
  };

  bool is_prepared() { return prepared; }

  Graph() : N(0), M(0), prepared(0) {}
  Graph(int N) : N(N), M(0), prepared(0) {}

  void build(int n) {
    N = n, M = 0;
    prepared = 0;
    edges.clear();
    indptr.clear();
    csr_edges.clear();
    vc_deg.clear();
    vc_indeg.clear();
    vc_outdeg.clear();
  }

  void add(int frm, int to, T cost = 1, int i = -1) {
    assert(!prepared);
    assert(0 <= frm && 0 <= to && to < N);
    if (i == -1) i = M;
    auto e = edge_type({frm, to, cost, i});
    edges.eb(e);
    ++M;
  }

#ifdef FASTIO
  // wt, off
  void read_tree(bool wt = false, int off = 1) { read_graph(N - 1, wt, off); }

  void read_graph(int M, bool wt = false, int off = 1) {
    for (int m = 0; m < M; ++m) {
      INT(a, b);
      a -= off, b -= off;
      if (!wt) {
        add(a, b);
      } else {
        T c;
        read(c);
        add(a, b, c);
      }
    }
    build();
  }
#endif

  void build() {
    assert(!prepared);
    prepared = true;
    indptr.assign(N + 1, 0);
    for (auto&& e: edges) {
      indptr[e.frm + 1]++;
      if (!directed) indptr[e.to + 1]++;
    }
    for (int v = 0; v < N; ++v) { indptr[v + 1] += indptr[v]; }
    auto counter = indptr;
    csr_edges.resize(indptr.back() + 1);
    for (auto&& e: edges) {
      csr_edges[counter[e.frm]++] = e;
      if (!directed)
        csr_edges[counter[e.to]++] = edge_type({e.to, e.frm, e.cost, e.id});
    }
  }

  OutgoingEdges operator[](int v) const {
    assert(prepared);
    return {this, indptr[v], indptr[v + 1]};
  }

  vc<int> deg_array() {
    if (vc_deg.empty()) calc_deg();
    return vc_deg;
  }

  pair<vc<int>, vc<int>> deg_array_inout() {
    if (vc_indeg.empty()) calc_deg_inout();
    return {vc_indeg, vc_outdeg};
  }

  int deg(int v) {
    if (vc_deg.empty()) calc_deg();
    return vc_deg[v];
  }

  int in_deg(int v) {
    if (vc_indeg.empty()) calc_deg_inout();
    return vc_indeg[v];
  }

  int out_deg(int v) {
    if (vc_outdeg.empty()) calc_deg_inout();
    return vc_outdeg[v];
  }

#ifdef FASTIO
  void debug() {
    print("Graph");
    if (!prepared) {
      print("frm to cost id");
      for (auto&& e: edges) print(e.frm, e.to, e.cost, e.id);
    } else {
      print("indptr", indptr);
      print("frm to cost id");
      FOR(v, N) for (auto&& e: (*this)[v]) print(e.frm, e.to, e.cost, e.id);
    }
  }
#endif

  vc<int> new_idx;
  vc<bool> used_e;

  // G における頂点 V[i] が、新しいグラフで i になるようにする
  // {G, es}
  // sum(deg(v)) の計算量になっていて、
  // 新しいグラフの n+m より大きい可能性があるので注意
  Graph<T, directed> rearrange(vc<int> V, bool keep_eid = 0) {
    if (len(new_idx) != N) new_idx.assign(N, -1);
    int n = len(V);
    FOR(i, n) new_idx[V[i]] = i;
    Graph<T, directed> G(n);
    vc<int> history;
    FOR(i, n) {
      for (auto&& e: (*this)[V[i]]) {
        if (len(used_e) <= e.id) used_e.resize(e.id + 1);
        if (used_e[e.id]) continue;
        int a = e.frm, b = e.to;
        if (new_idx[a] != -1 && new_idx[b] != -1) {
          history.eb(e.id);
          used_e[e.id] = 1;
          int eid = (keep_eid ? e.id : -1);
          G.add(new_idx[a], new_idx[b], e.cost, eid);
        }
      }
    }
    FOR(i, n) new_idx[V[i]] = -1;
    for (auto&& eid: history) used_e[eid] = 0;
    G.build();
    return G;
  }

  Graph<T, true> to_directed_tree(int root = -1) {
    if (root == -1) root = 0;
    assert(!is_directed && prepared && M == N - 1);
    Graph<T, true> G1(N);
    vc<int> par(N, -1);
    auto dfs = [&](auto& dfs, int v) -> void {
      for (auto& e: (*this)[v]) {
        if (e.to == par[v]) continue;
        par[e.to] = v, dfs(dfs, e.to);
      }
    };
    dfs(dfs, root);
    for (auto& e: edges) {
      int a = e.frm, b = e.to;
      if (par[a] == b) swap(a, b);
      assert(par[b] == a);
      G1.add(a, b, e.cost);
    }
    G1.build();
    return G1;
  }

private:
  void calc_deg() {
    assert(vc_deg.empty());
    vc_deg.resize(N);
    for (auto&& e: edges) vc_deg[e.frm]++, vc_deg[e.to]++;
  }

  void calc_deg_inout() {
    assert(vc_indeg.empty());
    vc_indeg.resize(N);
    vc_outdeg.resize(N);
    for (auto&& e: edges) { vc_indeg[e.to]++, vc_outdeg[e.frm]++; }
  }
};
#line 4 "/home/maspy/compro/library/graph/tree.hpp"

// HLD euler tour をとっていろいろ。
template <typename GT>
struct Tree {
  using Graph_type = GT;
  GT &G;
  using WT = typename GT::cost_type;
  int N;
  vector<int> LID, RID, head, V, parent, VtoE;
  vc<int> depth;
  vc<WT> depth_weighted;

  Tree(GT &G, int r = 0, bool hld = 1) : G(G) { build(r, hld); }

  void build(int r = 0, bool hld = 1) {
    if (r == -1) return; // build を遅延したいとき
    N = G.N;
    LID.assign(N, -1), RID.assign(N, -1), head.assign(N, r);
    V.assign(N, -1), parent.assign(N, -1), VtoE.assign(N, -1);
    depth.assign(N, -1), depth_weighted.assign(N, 0);
    assert(G.is_prepared());
    int t1 = 0;
    dfs_sz(r, -1, hld);
    dfs_hld(r, t1);
  }

  void dfs_sz(int v, int p, bool hld) {
    auto &sz = RID;
    parent[v] = p;
    depth[v] = (p == -1 ? 0 : depth[p] + 1);
    sz[v] = 1;
    int l = G.indptr[v], r = G.indptr[v + 1];
    auto &csr = G.csr_edges;
    // 使う辺があれば先頭にする
    for (int i = r - 2; i >= l; --i) {
      if (hld && depth[csr[i + 1].to] == -1) swap(csr[i], csr[i + 1]);
    }
    int hld_sz = 0;
    for (int i = l; i < r; ++i) {
      auto e = csr[i];
      if (depth[e.to] != -1) continue;
      depth_weighted[e.to] = depth_weighted[v] + e.cost;
      VtoE[e.to] = e.id;
      dfs_sz(e.to, v, hld);
      sz[v] += sz[e.to];
      if (hld && chmax(hld_sz, sz[e.to]) && l < i) { swap(csr[l], csr[i]); }
    }
  }

  void dfs_hld(int v, int &times) {
    LID[v] = times++;
    RID[v] += LID[v];
    V[LID[v]] = v;
    bool heavy = true;
    for (auto &&e: G[v]) {
      if (depth[e.to] <= depth[v]) continue;
      head[e.to] = (heavy ? head[v] : e.to);
      heavy = false;
      dfs_hld(e.to, times);
    }
  }

  vc<int> heavy_path_at(int v) {
    vc<int> P = {v};
    while (1) {
      int a = P.back();
      for (auto &&e: G[a]) {
        if (e.to != parent[a] && head[e.to] == v) {
          P.eb(e.to);
          break;
        }
      }
      if (P.back() == a) break;
    }
    return P;
  }

  int heavy_child(int v) {
    int k = LID[v] + 1;
    if (k == N) return -1;
    int w = V[k];
    return (parent[w] == v ? w : -1);
  }

  int e_to_v(int eid) {
    auto e = G.edges[eid];
    return (parent[e.frm] == e.to ? e.frm : e.to);
  }
  int v_to_e(int v) { return VtoE[v]; }
  int get_eid(int u, int v) {
    if (parent[u] != v) swap(u, v);
    assert(parent[u] == v);
    return VtoE[u];
  }

  int ELID(int v) { return 2 * LID[v] - depth[v]; }
  int ERID(int v) { return 2 * RID[v] - depth[v] - 1; }

  // 目標地点へ進む個数が k
  int LA(int v, int k) {
    assert(k <= depth[v]);
    while (1) {
      int u = head[v];
      if (LID[v] - k >= LID[u]) return V[LID[v] - k];
      k -= LID[v] - LID[u] + 1;
      v = parent[u];
    }
  }
  int la(int u, int v) { return LA(u, v); }

  int LCA(int u, int v) {
    for (;; v = parent[head[v]]) {
      if (LID[u] > LID[v]) swap(u, v);
      if (head[u] == head[v]) return u;
    }
  }

  int meet(int a, int b, int c) { return LCA(a, b) ^ LCA(a, c) ^ LCA(b, c); }
  int lca(int u, int v) { return LCA(u, v); }

  int subtree_size(int v, int root = -1) {
    if (root == -1) return RID[v] - LID[v];
    if (v == root) return N;
    int x = jump(v, root, 1);
    if (in_subtree(v, x)) return RID[v] - LID[v];
    return N - RID[x] + LID[x];
  }

  int dist(int a, int b) {
    int c = LCA(a, b);
    return depth[a] + depth[b] - 2 * depth[c];
  }

  WT dist_weighted(int a, int b) {
    int c = LCA(a, b);
    return depth_weighted[a] + depth_weighted[b] - WT(2) * depth_weighted[c];
  }

  // a is in b
  bool in_subtree(int a, int b) { return LID[b] <= LID[a] && LID[a] < RID[b]; }

  int jump(int a, int b, ll k) {
    if (k == 1) {
      if (a == b) return -1;
      return (in_subtree(b, a) ? LA(b, depth[b] - depth[a] - 1) : parent[a]);
    }
    int c = LCA(a, b);
    int d_ac = depth[a] - depth[c];
    int d_bc = depth[b] - depth[c];
    if (k > d_ac + d_bc) return -1;
    if (k <= d_ac) return LA(a, k);
    return LA(b, d_ac + d_bc - k);
  }

  vc<int> collect_child(int v) {
    vc<int> res;
    for (auto &&e: G[v])
      if (e.to != parent[v]) res.eb(e.to);
    return res;
  }

  vc<int> collect_light(int v) {
    vc<int> res;
    bool skip = true;
    for (auto &&e: G[v])
      if (e.to != parent[v]) {
        if (!skip) res.eb(e.to);
        skip = false;
      }
    return res;
  }

  vc<pair<int, int>> get_path_decomposition(int u, int v, bool edge) {
    // [始点, 終点] の"閉"区間列。
    vc<pair<int, int>> up, down;
    while (1) {
      if (head[u] == head[v]) break;
      if (LID[u] < LID[v]) {
        down.eb(LID[head[v]], LID[v]);
        v = parent[head[v]];
      } else {
        up.eb(LID[u], LID[head[u]]);
        u = parent[head[u]];
      }
    }
    if (LID[u] < LID[v]) down.eb(LID[u] + edge, LID[v]);
    elif (LID[v] + edge <= LID[u]) up.eb(LID[u], LID[v] + edge);
    reverse(all(down));
    up.insert(up.end(), all(down));
    return up;
  }

  // 辺の列の情報 (frm,to,str)
  // str = "heavy_up", "heavy_down", "light_up", "light_down"
  vc<tuple<int, int, string>> get_path_decomposition_detail(int u, int v) {
    vc<tuple<int, int, string>> up, down;
    while (1) {
      if (head[u] == head[v]) break;
      if (LID[u] < LID[v]) {
        if (v != head[v]) down.eb(head[v], v, "heavy_down"), v = head[v];
        down.eb(parent[v], v, "light_down"), v = parent[v];
      } else {
        if (u != head[u]) up.eb(u, head[u], "heavy_up"), u = head[u];
        up.eb(u, parent[u], "light_up"), u = parent[u];
      }
    }
    if (LID[u] < LID[v]) down.eb(u, v, "heavy_down");
    elif (LID[v] < LID[u]) up.eb(u, v, "heavy_up");
    reverse(all(down));
    concat(up, down);
    return up;
  }

  vc<int> restore_path(int u, int v) {
    vc<int> P;
    for (auto &&[a, b]: get_path_decomposition(u, v, 0)) {
      if (a <= b) {
        FOR(i, a, b + 1) P.eb(V[i]);
      } else {
        FOR_R(i, b, a + 1) P.eb(V[i]);
      }
    }
    return P;
  }

  // path [a,b] と [c,d] の交わり. 空ならば {-1,-1}.
  // https://codeforces.com/problemset/problem/500/G
  pair<int, int> path_intersection(int a, int b, int c, int d) {
    int ab = lca(a, b), ac = lca(a, c), ad = lca(a, d);
    int bc = lca(b, c), bd = lca(b, d), cd = lca(c, d);
    int x = ab ^ ac ^ bc, y = ab ^ ad ^ bd; // meet(a,b,c), meet(a,b,d)
    if (x != y) return {x, y};
    int z = ac ^ ad ^ cd;
    if (x != z) x = -1;
    return {x, x};
  }
};
#line 4 "main.cpp"

/*
平均、個数
*/

using Re = double;

void solve() {
  LL(N);
  Graph<int, 1> G(N);
  FOR(v, 1, N) {
    INT(p);
    --p;
    G.add(p, v);
  }
  G.build();

  VEC(Re, A, N);
  vc<Re> ANS(N);

  auto dfs = [&](auto& dfs, int v) -> pq<pair<Re, int>> {
    pq<pair<Re, int>> que;
    for (auto& e: G[v]) {
      auto que1 = dfs(dfs, e.to);
      if (len(que) < len(que1)) swap(que, que1);
      while (len(que1)) que.emplace(POP(que1));
    }
    Re x = A[v];
    int n = 1;
    while (len(que) && x < que.top().fi) {
      auto [y, m] = POP(que);
      x = (x * n + y * m) / (n + m);
      n += m;
    }

    ANS[v] = x;
    que.emplace(x, n);
    return que;
  };
  dfs(dfs, 0);
  for (auto& x: ANS) print(x);
}

signed main() { solve(); }

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 2ms
memory: 4116kb

input:

2000
1 2 2 4 5 2 3 6 4 2 7 2 8 14 8 12 1 14 4 14 8 18 9 2 7 22 20 22 14 29 28 16 6 21 23 6 21 14 13 9 1 4 18 13 2 39 21 33 18 20 38 27 27 1 49 5 51 3 31 24 10 42 2 44 13 9 35 66 27 60 67 59 29 40 53 2 33 43 26 43 62 16 78 45 14 10 73 69 41 35 25 26 2 70 54 1 54 48 5 36 44 28 90 29 51 51 93 82 95 45 ...

output:

883838885.923076868057251
887174926.000000000000000
881025216.709677457809448
912609654.666666626930237
872318573.500000000000000
831791515.153846144676208
867874850.000000000000000
892392319.166666626930237
836427216.000000000000000
869519853.799999952316284
693335785.375000000000000
925100890.0000...

result:

ok 2000 numbers

Test #2:

score: 10
Accepted
time: 2ms
memory: 4048kb

input:

2000
1 1 1 1 1 6 6 6 8 1 7 6 9 4 11 10 17 1 9 20 4 2 7 22 13 21 5 26 19 20 9 8 24 22 32 24 24 8 30 7 22 22 7 14 4 18 30 38 9 45 21 38 53 16 39 6 44 12 10 34 14 17 54 14 65 55 17 21 40 9 27 65 54 53 61 30 3 52 57 49 31 34 16 32 11 85 81 43 36 43 3 45 42 93 83 37 86 77 2 23 41 77 19 18 51 91 68 22 85 ...

output:

794920955.220000028610229
713825019.500000000000000
734115991.799999952316284
800547209.783783793449402
734508347.000000000000000
760946433.375000000000000
750093634.897959232330322
735976830.111111164093018
765501191.941176414489746
747665901.952380895614624
816306482.500000000000000
741938108.1111...

result:

ok 2000 numbers

Test #3:

score: 10
Accepted
time: 2ms
memory: 4052kb

input:

2000
1 1 2 3 3 3 3 4 2 8 4 6 2 10 1 8 8 13 1 19 15 18 8 17 20 16 16 21 11 28 14 18 31 4 30 24 17 10 22 26 2 34 14 13 13 37 43 3 3 38 9 4 29 43 29 46 7 55 9 23 23 49 29 12 45 25 67 59 45 24 5 55 52 73 51 28 25 26 49 78 62 10 18 1 35 73 35 16 52 62 5 89 4 49 12 46 55 14 18 68 64 25 21 88 25 19 82 46 4...

output:

755177543.516129016876221
762060513.294117689132690
754126791.262500047683716
777333185.549999952316284
758703127.500000000000000
756576527.222222208976746
764146306.785714268684387
750062914.139999985694885
710728919.812500000000000
770351278.750000000000000
769495170.000000000000000
776873566.5714...

result:

ok 2000 numbers

Test #4:

score: 10
Accepted
time: 2ms
memory: 4276kb

input:

2000
1 1 3 4 1 1 4 3 3 2 1 3 11 3 1 7 17 9 7 18 4 5 16 10 16 14 12 6 16 22 28 32 27 4 4 19 36 38 12 31 28 18 30 44 35 43 44 29 10 29 7 18 18 35 23 42 12 24 23 2 42 59 8 24 14 49 16 62 38 46 7 34 41 41 10 20 53 71 18 38 63 54 26 76 39 84 28 36 9 53 26 19 39 34 26 49 86 10 64 34 74 43 19 70 97 35 92 4...

output:

914894038.533333301544189
918141155.833333373069763
911927555.000000000000000
870659540.153846144676208
777969562.235294103622437
778920774.555555582046509
876560725.000000000000000
974455318.000000000000000
858643515.250000000000000
835985850.619047403335571
963419161.250000000000000
868819817.0000...

result:

ok 2000 numbers

Test #5:

score: 10
Accepted
time: 3ms
memory: 4212kb

input:

2000
1 2 2 3 2 1 7 8 8 6 9 12 12 3 8 3 9 15 3 19 8 7 4 19 18 23 10 21 10 15 10 22 1 21 19 26 1 38 38 1 18 37 14 27 37 43 30 4 2 2 13 42 13 9 13 38 21 23 58 32 13 62 18 62 15 49 5 61 1 45 29 48 38 34 31 43 45 38 52 54 13 21 78 36 21 45 57 14 25 18 29 45 2 43 8 51 75 79 95 55 29 98 55 93 33 5 93 14 77...

output:

865975765.954023003578186
864960665.600000023841858
853815173.555555582046509
725289681.799999952316284
835914002.750000000000000
751151162.299999952316284
880779494.263157844543457
883843482.916666626930237
866946310.460000038146973
875695250.272727251052856
798984107.399999976158142
869102654.8928...

result:

ok 2000 numbers

Test #6:

score: 10
Accepted
time: 2ms
memory: 4176kb

input:

2000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...

output:

780031265.285714268684387
709196423.634146332740784
852016017.000000000000000
710198590.855072498321533
942523004.000000000000000
795582647.000000000000000
817131607.000000000000000
723247621.674999952316284
711787456.321428537368774
702698215.818181872367859
778948304.750000000000000
825829512.6666...

result:

ok 2000 numbers

Test #7:

score: 10
Accepted
time: 2ms
memory: 4008kb

input:

2000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...

output:

621161049.048780441284180
460347579.946153819561005
624970425.723926424980164
386751620.240310072898865
463913107.317829430103302
565084289.953488349914551
628866372.379844903945923
344826388.199999988079071
389755854.015625000000000
428515994.796875000000000
467520113.531250000000000
517598544.1640...

result:

ok 2000 numbers

Test #8:

score: 10
Accepted
time: 2ms
memory: 4072kb

input:

2000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...

output:

621374004.574879169464111
487030122.875000000000000
624597241.700000047683716
939364019.000000000000000
480110389.248062014579773
578610052.999999880790710
628514468.213836431503296
497600202.000000000000000
398302285.670103073120117
430778150.178861796855927
483844086.023437500000000
534427093.2698...

result:

ok 2000 numbers

Test #9:

score: 10
Accepted
time: 2ms
memory: 4064kb

input:

2000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...

output:

762088830.233333349227905
781353370.172413825988770
714336862.833333373069763
723995695.130434751510620
787379090.464285731315613
708370854.052631616592407
735529969.826086997985840
725933828.318181753158569
721088075.738095283508301
810402666.888888835906982
798070041.714285731315613
761321868.0000...

result:

ok 2000 numbers

Test #10:

score: 10
Accepted
time: 2ms
memory: 4276kb

input:

2000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 5...

output:

796409562.000000000000000
777105384.250000000000000
719995401.840000033378601
755696351.523809552192688
972657380.000000000000000
705728479.946428537368774
822339463.666666626930237
756514023.714285731315613
858700663.000000000000000
980362468.000000000000000
924539106.000000000000000
708454243.0000...

result:

ok 2000 numbers

Test #11:

score: 10
Accepted
time: 2ms
memory: 4264kb

input:

2000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

984618295.615384578704834
902277197.000000000000000
383235589.000000000000000
742640716.000000000000000
613666672.000000000000000
291453150.000000000000000
625937043.000000000000000
958739025.000000000000000
34831727.000000000000000
240997073.000000000000000
334863696.000000000000000
223278814.00000...

result:

ok 2000 numbers

Test #12:

score: 10
Accepted
time: 2ms
memory: 4540kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

506787773.313432812690735
507473433.654135346412659
508859284.166666686534882
556160454.250000000000000
620472531.000000000000000
867793536.000000000000000
786222333.000000000000000
511025497.680851042270660
532981265.428571403026581
612986220.000000000000000
767631955.666666626930237
992646284.0000...

result:

ok 2000 numbers

Test #13:

score: 10
Accepted
time: 2ms
memory: 4480kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

470231718.696500599384308
470466543.196098685264587
470701431.425426065921783
470936546.634953022003174
471171816.946894407272339
471407223.846115887165070
471642829.774323582649231
471878447.555444657802582
472114168.722390174865723
472349720.805123686790466
472585326.962312161922455
472820288.2855...

result:

ok 2000 numbers

Test #14:

score: 10
Accepted
time: 2ms
memory: 4380kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

483979076.412999927997589
484220856.564282059669495
484462747.642142057418823
484704388.627441108226776
484945699.843186318874359
485187059.897744297981262
485428332.702106237411499
759340416.000000000000000
485532302.721385478973389
485773818.607734739780426
485873366.313567757606506
486115034.5515...

result:

ok 2000 numbers

Test #15:

score: 10
Accepted
time: 2ms
memory: 4384kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

685495666.500000000000000
869312055.000000000000000
517163136.736842095851898
526888922.166666686534882
654153657.000000000000000
547770219.333333373069763
569562360.333333373069763
819660511.500000000000000
847532860.000000000000000
564798030.600000023841858
855185985.000000000000000
585505461.3333...

result:

ok 2000 numbers

Test #16:

score: 10
Accepted
time: 2ms
memory: 4680kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

491106693.508771955966949
494822795.928571403026581
501410786.145454525947571
504759328.592592597007751
512059105.358490586280823
513949461.363636374473572
522550566.899999976158142
915653935.000000000000000
537905061.000000000000000
581374942.571428537368774
920748817.000000000000000
597709195.2000...

result:

ok 2000 numbers

Test #17:

score: 10
Accepted
time: 2ms
memory: 4148kb

input:

2000
1 1 3 3 2 5 4 2 1 5 7 1 7 5 11 7 13 15 15 18 12 17 13 19 15 12 25 18 24 30 30 23 19 20 32 36 25 27 30 37 28 33 34 35 31 38 35 45 48 50 48 50 40 45 43 49 53 53 52 54 61 56 53 63 60 58 54 58 68 68 69 68 70 73 62 71 71 77 69 69 71 74 72 76 79 80 81 83 75 86 90 86 91 91 91 85 90 88 99 90 94 91 102 ...

output:

734060776.500000000000000
907170094.000000000000000
884436883.000000000000000
248349393.000000000000000
731751628.857142806053162
122787902.000000000000000
631204225.000000000000000
3817027.000000000000000
52135197.000000000000000
803280314.000000000000000
259513623.000000000000000
590964999.5000000...

result:

ok 2000 numbers

Test #18:

score: 10
Accepted
time: 2ms
memory: 4360kb

input:

2000
1 1 1 3 1 5 1 7 6 6 8 3 9 7 14 2 7 7 11 7 13 19 19 12 16 13 18 16 19 23 18 32 24 34 32 31 28 34 26 31 41 28 42 30 33 43 47 38 49 38 49 40 41 49 44 45 54 52 51 53 55 59 52 61 52 61 65 65 60 58 62 68 73 65 71 76 64 71 68 73 67 75 73 75 75 80 81 76 76 87 77 85 93 82 93 84 89 97 88 89 96 102 92 100...

output:

712001072.839285492897034
4201358.500000000000000
713061983.144560217857361
2244053.000000000000000
714122990.614925146102905
5225148.333333333022892
715187323.005996704101562
5869207.000000000000000
716256611.593984723091125
3957454.000000000000000
6429324.000000000000000
7157175.000000000000000
83...

result:

ok 2000 numbers

Test #19:

score: 10
Accepted
time: 2ms
memory: 4256kb

input:

2000
1 1 1 2 1 6 2 5 1 2 9 11 1 13 10 12 5 5 13 13 14 17 14 22 13 15 16 16 28 21 31 18 26 21 21 26 34 28 39 31 36 32 34 40 34 40 44 46 46 46 50 47 45 53 42 42 46 46 49 47 60 62 59 61 59 59 66 63 67 60 62 70 68 64 62 70 68 70 79 76 81 75 80 70 80 85 85 85 85 83 80 88 89 92 83 90 93 95 99 93 100 88 89...

output:

697496384.399360656738281
698611495.703999638557434
143289881.000000000000000
1583426.000000000000000
9656032.750000000000000
2424102.000000000000000
2532741.000000000000000
3850673.000000000000000
7472201.000000000000000
518530306.000000000000000
699729704.716345787048340
8643690.333333333954215
70...

result:

ok 2000 numbers

Test #20:

score: 10
Accepted
time: 2ms
memory: 4244kb

input:

2000
1 1 1 3 1 4 3 7 5 6 7 3 7 8 10 6 13 4 12 18 16 16 10 15 20 18 15 24 15 19 24 21 32 22 25 25 33 30 37 37 40 29 31 32 40 39 44 38 39 45 50 52 46 45 48 45 46 47 56 48 51 49 63 51 57 63 61 57 58 58 64 61 63 60 61 63 71 77 66 78 77 70 81 70 85 80 83 84 84 77 78 86 84 85 91 82 83 85 92 92 88 92 101 1...

output:

788364530.666666626930237
291116820.000000000000000
705269522.000000000000000
968497131.000000000000000
479210979.500000000000000
984278789.000000000000000
749238791.000000000000000
650055971.263157844543457
330485123.000000000000000
502037324.000000000000000
306298229.000000000000000
306940374.3333...

result:

ok 2000 numbers

Test #21:

score: 10
Accepted
time: 0ms
memory: 4208kb

input:

2000
1 1 3 4 1 4 7 3 9 5 1 6 8 5 12 16 6 12 13 15 11 15 13 17 20 21 14 14 21 19 22 18 30 25 28 36 26 24 37 34 40 39 43 44 37 44 44 36 49 38 40 51 48 42 49 47 53 48 51 58 48 62 57 59 65 59 65 59 57 69 63 62 64 70 72 75 64 77 70 68 71 80 78 77 79 78 87 86 86 84 84 89 84 84 88 92 91 85 98 99 101 90 96 ...

output:

652426645.721591234207153
506709211.000000000000000
626941277.666666626930237
640221680.000000000000000
530323185.833333313465118
829464142.000000000000000
531001334.666666686534882
577506393.799999952316284
991902092.000000000000000
1000662.000000000000000
123643298.000000000000000
660010334.000000...

result:

ok 2000 numbers

Test #22:

score: 10
Accepted
time: 0ms
memory: 4288kb

input:

2000
1 2 3 4 4 3 7 3 9 7 7 9 12 14 4 7 1 18 7 6 19 11 21 24 23 15 22 3 1 14 9 24 26 14 9 8 1 32 21 13 11 4 3 4 25 24 18 10 9 36 10 18 53 25 6 26 19 26 44 29 34 56 40 63 60 43 50 63 52 64 59 56 62 52 50 72 47 55 67 48 55 54 53 44 57 81 44 64 49 61 44 43 52 78 91 60 48 71 74 78 83 63 72 64 96 59 75 77...

output:

661041438.183333277702332
709912195.857142806053162
738067587.000000000000000
723579217.399999976158142
671235505.000000000000000
661735797.645161271095276
661572310.395833373069763
592983701.000000000000000
616968314.687500000000000
649054462.933333277702332
777022558.000000000000000
455883204.2500...

result:

ok 2000 numbers

Test #23:

score: 10
Accepted
time: 3ms
memory: 4044kb

input:

2000
1 2 1 1 3 3 5 3 1 8 3 7 12 2 6 13 6 18 1 4 17 12 5 4 4 8 9 21 24 17 13 26 3 9 23 28 9 38 18 1 29 35 14 43 40 23 46 25 13 30 40 23 7 45 39 39 28 58 24 32 31 56 39 35 21 26 27 48 39 65 52 24 45 39 52 62 66 30 64 45 60 56 67 57 47 56 47 49 70 51 67 47 51 64 66 79 70 80 92 64 73 68 63 61 64 79 107 ...

output:

784494649.520161271095276
728336562.564013838768005
730864296.579861164093018
787670154.591093063354492
53300176.888888888061047
24228432.000000000000000
97778937.736842125654221
37729196.714285716414452
733404194.550522685050964
6499714.000000000000000
6922127.000000000000000
25869385.8333333320915...

result:

ok 2000 numbers

Test #24:

score: 10
Accepted
time: 2ms
memory: 4100kb

input:

2000
1 2 1 4 4 3 3 4 6 2 5 10 11 9 11 16 13 12 6 12 19 12 14 9 23 8 8 28 5 14 21 20 8 5 5 16 9 33 39 24 25 3 19 29 15 7 46 39 32 42 45 13 34 40 21 29 29 39 18 59 59 18 43 37 29 43 31 22 66 40 47 47 56 25 58 60 62 68 51 41 51 42 64 46 54 84 85 52 74 70 67 48 76 49 89 82 69 49 77 58 62 75 99 100 102 7...

output:

783353173.857142806053162
204903172.454545468091965
229172725.625000000000000
785254461.148058295249939
16952640.899999998509884
329675480.375000000000000
199435398.000000000000000
182894354.222222208976746
787160780.527980566024780
484557370.500000000000000
15562280.124999998137355
18638362.1111111...

result:

ok 2000 numbers

Test #25:

score: 10
Accepted
time: 2ms
memory: 4360kb

input:

2000
1 1 2 1 2 3 5 8 9 4 9 1 1 9 8 6 8 1 8 9 14 16 7 4 10 13 19 24 21 23 6 3 28 21 8 33 21 17 26 20 25 27 11 28 21 42 32 27 16 30 28 29 31 25 8 51 31 54 12 38 15 23 21 28 42 33 30 54 38 33 53 71 71 33 38 74 45 57 77 69 76 80 81 64 51 66 83 52 75 49 47 86 74 52 81 53 66 65 72 86 57 73 69 100 96 96 70...

output:

712379791.027777791023254
730937711.625000000000000
594520594.142857193946838
783452017.714285731315613
750107897.272727251052856
327405835.666666686534882
533643015.724137902259827
760578428.700000047683716
716674385.666666626930237
530704206.000000000000000
873840570.000000000000000
558880384.0000...

result:

ok 2000 numbers

Test #26:

score: 10
Accepted
time: 2ms
memory: 4064kb

input:

2000
1 2 2 3 3 3 7 2 6 2 8 4 13 14 1 8 13 17 13 15 13 10 11 22 24 12 22 16 6 6 10 14 13 30 10 25 27 20 37 5 13 27 14 19 21 1 24 42 21 36 36 4 46 30 41 41 51 22 10 15 22 19 27 28 20 42 42 47 22 58 68 37 56 63 51 40 36 45 40 59 62 56 73 58 62 45 75 87 78 63 67 66 48 49 51 68 85 68 55 64 64 88 98 80 99...

output:

862103310.000000000000000
646331770.147058844566345
647879605.208955168724060
937931035.000000000000000
846045856.000000000000000
653605854.854838728904724
647401386.578947186470032
763227900.000000000000000
356421127.000000000000000
664412500.559999942779541
583588916.750000000000000
678335454.3333...

result:

ok 2000 numbers

Test #27:

score: 10
Accepted
time: 2ms
memory: 3956kb

input:

2000
1 2 1 1 5 3 2 3 2 2 5 12 7 12 14 5 8 7 15 11 2 2 1 17 21 13 6 19 16 17 7 24 29 23 7 9 4 17 18 22 16 30 4 44 18 4 44 33 41 30 2 1 50 39 8 52 54 25 18 25 57 8 39 14 10 19 49 50 28 28 29 60 15 28 65 3 43 70 16 52 65 47 30 34 37 51 54 55 86 39 70 87 86 80 27 54 6 93 75 93 98 18 68 85 60 98 45 18 78...

output:

822926380.296296238899231
836531986.521739125251770
864103360.333333373069763
725945381.133333325386047
779930151.909090876579285
789866906.571428537368774
724645048.263157844543457
905205645.000000000000000
849643920.000000000000000
801687438.200000047683716
801268636.583333373069763
734015025.6000...

result:

ok 2000 numbers

Test #28:

score: 10
Accepted
time: 2ms
memory: 4144kb

input:

2000
1 1 1 4 5 1 3 5 3 5 6 2 4 1 9 13 11 11 7 6 16 9 4 16 14 12 4 2 24 16 5 22 17 22 13 24 25 38 1 7 6 18 2 42 19 43 19 23 3 47 14 45 30 37 25 9 44 44 11 55 51 7 8 21 33 66 49 63 9 53 21 13 58 21 37 63 4 31 60 65 52 7 10 18 68 20 43 53 45 62 85 64 40 41 35 7 72 50 89 85 57 49 90 93 60 63 44 37 8 85 ...

output:

618462437.884615421295166
567825893.250000000000000
567302445.325581431388855
619847729.736842155456543
628079388.062500000000000
587316194.777777791023254
576029985.333333373069763
592047118.095238089561462
572320227.069767475128174
534341960.277777791023254
562681987.437500000000000
572746051.1388...

result:

ok 2000 numbers

Test #29:

score: 10
Accepted
time: 2ms
memory: 3980kb

input:

2000
1 2 1 3 3 5 1 8 2 2 7 10 9 5 7 16 5 2 10 18 18 14 16 24 7 14 24 2 10 11 19 29 2 16 12 18 19 5 16 10 35 12 37 14 28 20 10 8 38 8 22 9 33 16 3 14 22 47 18 32 56 58 6 22 22 39 36 33 17 40 10 46 29 17 17 11 11 21 62 20 51 7 47 52 83 81 7 60 61 83 42 69 82 77 48 77 44 58 23 23 29 33 63 63 102 49 36 ...

output:

640682607.677419304847717
654794201.896551728248596
623724048.018518567085266
563367862.000000000000000
629996062.617021322250366
578005048.625000000000000
644883765.951219558715820
609658376.514285683631897
627572405.100000023841858
666070655.538461565971375
552742688.000000000000000
596053806.6216...

result:

ok 2000 numbers

Test #30:

score: 10
Accepted
time: 2ms
memory: 4060kb

input:

2000
1 2 1 4 5 2 5 8 5 3 4 11 3 4 9 1 4 11 14 18 19 11 21 13 22 9 15 13 14 24 9 22 31 33 23 16 33 19 34 21 10 40 40 28 30 24 9 45 28 28 20 2 12 15 22 55 54 10 18 25 56 24 42 28 36 13 63 48 49 34 16 56 1 14 27 1 1 31 43 50 71 20 61 72 50 57 53 11 15 65 2 1 24 87 33 77 33 54 26 91 43 12 53 44 6 101 95...

output:

875749748.750000000000000
980775550.000000000000000
792393684.733333349227905
877334746.000000000000000
892872799.250000000000000
692917302.444444417953491
844673232.000000000000000
968336393.000000000000000
809407059.000000000000000
841448499.666666626930237
802109709.227272748947144
822804828.6666...

result:

ok 2000 numbers

Test #31:

score: 10
Accepted
time: 0ms
memory: 4096kb

input:

2000
1 2 3 2 1 5 2 7 1 10 6 2 11 4 3 16 10 3 14 12 3 22 9 15 11 11 17 6 16 15 14 14 1 15 32 14 16 29 25 31 3 24 26 37 3 24 38 24 46 5 13 7 31 3 3 32 42 18 16 5 46 60 57 33 34 55 42 23 63 26 57 62 32 40 57 75 47 73 37 28 57 70 78 6 82 86 61 53 17 60 3 7 19 10 36 72 55 95 45 5 15 22 34 57 105 58 18 69...

output:

947322572.500000000000000
829209491.375000000000000
924970046.000000000000000
856705493.000000000000000
797400719.555555582046509
800729961.250000000000000
740208777.000000000000000
711780199.500000000000000
712300705.833333373069763
992631065.500000000000000
993761731.000000000000000
770162261.5000...

result:

ok 2000 numbers

Subtask #2:

score: 10
Accepted

Test #32:

score: 10
Accepted
time: 186ms
memory: 18164kb

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:

792545632.415493011474609
794937150.351351380348206
794843085.477611899375916
804131414.226415038108826
805846267.166666626930237
806376230.000000000000000
778037203.690476179122925
815562308.149999976158142
776087995.601265788078308
809328819.588235259056091
767722826.595375776290894
771619640.6969...

result:

ok 200000 numbers

Test #33:

score: 10
Accepted
time: 160ms
memory: 14104kb

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:

647279839.478769063949585
635973895.066731572151184
647532087.549103736877441
520992591.332845985889435
636283816.423002004623413
647784525.847953319549561
406566953.643588483333588
463185839.532910764217377
521246596.046318888664246
578740922.622135519981384
636594030.471477270126343
648037157.7063...

result:

ok 200000 numbers

Test #34:

score: 10
Accepted
time: 157ms
memory: 14916kb

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:

647754328.613556623458862
636746616.852826476097107
648006765.734606385231018
521510675.013651847839355
637057064.154558777809143
648259391.943859696388245
406874686.223305702209473
464547475.685714304447174
521775592.651948034763336
579595626.967804908752441
637367808.865365862846375
648512210.6579...

result:

ok 200000 numbers

Test #35:

score: 10
Accepted
time: 165ms
memory: 14124kb

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:

645282008.991906523704529
637131985.080817937850952
645927540.952716350555420
532495411.931034505367279
637752960.449317693710327
646578004.859013080596924
427748181.910000026226044
483202190.870069622993469
532964564.748329639434814
595909324.758269667625427
638382656.992071390151978
647229761.6673...

result:

ok 200000 numbers

Test #36:

score: 10
Accepted
time: 203ms
memory: 17916kb

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:

786262518.926966309547424
780254007.047999978065491
788435954.436708807945251
771824213.525345563888550
791202439.096774220466614
796752745.750000000000000
792549624.964601755142212
776723747.185185194015503
771848261.457943916320801
795200761.600000023841858
766509591.260869622230530
773506193.3529...

result:

ok 200000 numbers

Subtask #3:

score: 40
Accepted

Dependency #1:

100%
Accepted

Test #37:

score: 40
Accepted
time: 48ms
memory: 7988kb

input:

50000
1 2 2 1 3 5 3 8 6 9 10 4 3 8 9 11 14 9 9 13 8 3 14 10 1 21 12 18 27 13 24 11 33 19 34 26 33 21 19 19 40 22 12 32 29 33 12 11 42 48 51 16 51 17 7 5 49 21 50 58 16 37 15 30 6 43 22 63 22 33 56 52 14 45 75 12 66 1 70 78 46 7 8 10 21 68 9 85 40 51 73 17 48 74 57 62 14 51 21 79 74 58 66 13 94 46 3 ...

output:

971673085.545454502105713
975121900.312500000000000
969075132.673076868057251
975664002.133333325386047
960157266.246913552284241
968562798.779411792755127
960213680.344262242317200
971201676.462962985038757
967906002.122807025909424
967354382.315789461135864
970196379.807228922843933
966188758.6796...

result:

ok 50000 numbers

Test #38:

score: 40
Accepted
time: 39ms
memory: 8076kb

input:

50000
1 1 3 1 5 5 6 7 9 6 7 8 7 14 10 13 14 14 2 16 17 5 7 18 10 9 21 11 8 14 25 18 9 13 32 14 17 36 1 33 27 8 25 34 12 14 31 15 9 21 31 33 48 34 47 24 43 25 57 56 1 8 20 6 25 4 36 8 23 64 35 53 10 57 49 48 57 29 70 20 19 7 34 81 47 80 30 15 47 16 42 85 69 83 83 92 86 63 66 50 38 53 10 44 69 8 1 2 8...

output:

942224552.444444417953491
938592235.607142806053162
937276088.864583373069763
939690058.953125000000000
942753910.662309408187866
942778448.968750000000000
943085088.936026930809021
939757973.055214762687683
943331141.746212124824524
947374272.342857122421265
940465502.758620738983154
928695506.7222...

result:

ok 50000 numbers

Test #39:

score: 40
Accepted
time: 39ms
memory: 7748kb

input:

50000
1 1 1 1 2 1 1 7 6 8 4 12 3 4 11 14 6 15 11 15 20 4 9 9 25 21 9 11 4 30 19 28 28 6 16 7 32 16 33 4 4 41 18 31 14 26 43 38 9 26 33 22 42 17 25 4 56 55 39 30 50 61 35 46 21 56 41 14 46 18 20 22 6 48 16 67 17 14 1 2 43 37 23 48 70 57 20 47 43 8 66 22 24 18 54 49 33 38 19 79 82 35 39 3 87 53 11 30 ...

output:

944712388.434523820877075
941100098.687500000000000
943431999.166666626930237
949572433.694444417953491
928087523.538461565971375
938832869.693548440933228
944590270.030303001403809
941495820.905084729194641
938971215.914285659790039
936958101.428571462631226
942148662.700000047683716
943199654.0606...

result:

ok 50000 numbers

Test #40:

score: 40
Accepted
time: 39ms
memory: 7832kb

input:

50000
1 2 1 4 2 5 4 4 5 1 3 5 2 7 2 10 16 10 4 6 17 8 11 22 17 19 24 13 18 6 17 4 20 14 16 14 13 8 37 3 26 12 2 11 3 32 26 45 2 32 47 12 1 16 54 38 4 38 46 38 5 58 62 62 48 31 54 7 15 29 59 28 1 15 41 70 54 3 74 33 29 79 80 65 47 84 83 72 52 69 38 68 87 77 6 67 22 9 49 65 54 16 65 88 15 50 86 36 85 ...

output:

953956988.794285655021667
955753576.466666698455811
961681011.725490212440491
948605589.398104310035706
948679227.114503860473633
943895226.695652127265930
944979449.473684191703796
955746751.545454502105713
943245032.773584961891174
952594647.543859601020813
951420466.974025964736938
967090881.7105...

result:

ok 50000 numbers

Test #41:

score: 40
Accepted
time: 43ms
memory: 7724kb

input:

50000
1 2 1 2 1 5 2 1 7 2 10 7 6 13 15 13 16 9 3 3 3 9 7 5 4 5 9 12 17 7 18 15 8 16 8 25 18 13 25 38 37 40 31 33 37 5 45 44 17 38 13 33 27 7 6 36 1 43 20 51 10 37 29 55 51 22 45 43 62 68 16 72 14 37 63 71 3 44 26 43 79 11 29 63 64 23 65 37 46 40 78 14 18 33 37 8 72 31 42 4 97 100 1 54 92 95 39 52 4 ...

output:

964561950.532307744026184
964711274.920634865760803
962409995.229508161544800
974365017.692307710647583
965760173.429864287376404
954599031.923076868057251
967458305.416666626930237
954314641.918604612350464
958655949.588235259056091
981998170.833333373069763
962843546.648648619651794
953611496.4666...

result:

ok 50000 numbers

Test #42:

score: 40
Accepted
time: 49ms
memory: 6968kb

input:

50000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...

output:

773863494.054263591766357
775841788.197368383407593
830247017.000000000000000
842347961.000000000000000
791235723.000000000000000
909353052.000000000000000
757149328.333333373069763
735430381.072580695152283
772128189.215686321258545
932157234.666666626930237
779289752.692307710647583
817520136.0000...

result:

ok 50000 numbers

Test #43:

score: 40
Accepted
time: 37ms
memory: 5912kb

input:

50000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...

output:

643577475.006902456283569
633928660.822957158088684
644133215.905008673667908
519853211.895813047885895
634545875.282375812530518
644689898.312013864517212
404473778.446601927280426
461771925.238834977149963
520359827.647173464298248
577875991.443469762802124
635164272.693957090377808
645326620.3586...

result:

ok 50000 numbers

Test #44:

score: 40
Accepted
time: 34ms
memory: 5988kb

input:

50000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...

output:

642875596.490940451622009
632905812.206225633621216
643430748.175302267074585
520071274.180232584476471
633522063.780915260314941
643986851.173725128173828
405725519.989623844623566
464198184.287378668785095
521081065.190291285514832
578111833.261997342109680
634139500.133528232574463
644645751.4813...

result:

ok 50000 numbers

Test #45:

score: 40
Accepted
time: 44ms
memory: 6724kb

input:

50000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...

output:

873087446.000000000000000
647700608.603960394859314
658686109.086567163467407
891514193.000000000000000
649538346.748251795768738
658779802.311377286911011
539422730.506493449211121
554330688.928571343421936
578772977.461538434028625
609731117.833333373069763
654112106.408450841903687
661957499.8598...

result:

ok 50000 numbers

Test #46:

score: 40
Accepted
time: 45ms
memory: 6784kb

input:

50000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...

output:

767297605.473118305206299
767742339.293478250503540
741039032.336538434028625
761869530.605041980743408
768896292.263736248016357
974861468.000000000000000
747382676.725490212440491
764374664.288135647773743
770469513.050847411155701
756494391.655172467231750
775626354.126984119415283
743592645.4313...

result:

ok 50000 numbers

Test #47:

score: 40
Accepted
time: 38ms
memory: 7716kb

input:

50000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

994963454.235849022865295
283414155.000000000000000
428236415.000000000000000
216320268.000000000000000
799276813.000000000000000
187955146.000000000000000
516402728.000000000000000
561769656.000000000000000
351055255.000000000000000
587866416.000000000000000
876383211.000000000000000
487671139.0000...

result:

ok 50000 numbers

Test #48:

score: 40
Accepted
time: 42ms
memory: 15744kb

input:

50000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

743118558.666666626930237
797411881.000000000000000
882130895.000000000000000
551625635.111111164093018
617260520.625000000000000
978414185.000000000000000
670401000.000000000000000
889144857.000000000000000
620523911.250000000000000
745552884.333333373069763
758151726.500000000000000
767371185.0000...

result:

ok 50000 numbers

Test #49:

score: 40
Accepted
time: 39ms
memory: 15724kb

input:

50000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

477091753.136300921440125
477101295.161524176597595
477110837.371555805206299
477120379.622178256511688
477129921.954937338829041
477139464.564657390117645
477149007.124055802822113
477158549.990699648857117
477168092.881341934204102
477177635.784942209720612
477187178.577296376228333
477196720.6918...

result:

ok 50000 numbers

Test #50:

score: 40
Accepted
time: 40ms
memory: 15776kb

input:

50000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

475254069.814577758312225
475263574.929136335849762
475273080.275288760662079
475282585.873270153999329
475292090.890368938446045
475301596.056423366069794
475311101.048503577709198
475320606.361588358879089
475330111.801625967025757
475339617.279027938842773
475349122.976433038711548
475358629.0494...

result:

ok 50000 numbers

Test #51:

score: 40
Accepted
time: 39ms
memory: 15684kb

input:

50000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

475549514.084256887435913
475559025.168720245361328
475568536.617401599884033
475578048.353158056735992
475587560.305321276187897
475597072.486905574798584
475606584.799772858619690
475616097.309700250625610
475623522.255897819995880
475633035.105715930461884
475635979.832963466644287
827692018.0000...

result:

ok 50000 numbers

Test #52:

score: 40
Accepted
time: 35ms
memory: 15700kb

input:

50000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

692670347.500000000000000
919601718.333333373069763
928188102.000000000000000
937096966.000000000000000
676499766.000000000000000
739252107.500000000000000
820447758.500000000000000
981753755.000000000000000
794630409.000000000000000
684742729.500000000000000
765115626.399999976158142
786194323.7500...

result:

ok 50000 numbers

Test #53:

score: 40
Accepted
time: 38ms
memory: 8324kb

input:

50000
1 1 1 1 5 3 1 3 8 9 7 2 13 12 3 12 12 14 19 17 14 14 22 20 14 18 21 22 26 17 31 23 27 23 22 35 37 26 32 40 38 29 40 32 41 33 43 38 43 43 41 50 51 45 48 50 51 58 49 50 58 52 59 55 59 56 63 68 58 69 71 70 61 68 65 76 77 65 69 74 73 69 72 74 78 79 79 85 80 86 81 80 93 90 86 95 96 94 87 97 93 99 9...

output:

869081616.666666626930237
873980197.571428537368774
686874168.444444417953491
717233775.000000000000000
962869213.000000000000000
533957416.000000000000000
774012148.500000000000000
763400744.000000000000000
555181495.000000000000000
135641341.000000000000000
761689744.000000000000000
927614350.0000...

result:

ok 50000 numbers

Test #54:

score: 40
Accepted
time: 45ms
memory: 8152kb

input:

50000
1 1 1 3 1 6 7 1 9 6 3 8 13 13 10 14 3 9 11 17 7 10 18 13 18 21 24 21 15 19 27 22 33 25 25 22 30 28 26 32 28 40 41 34 45 37 38 35 46 43 51 40 50 46 45 47 53 46 56 47 56 55 51 61 61 62 54 56 57 64 58 58 69 70 69 73 67 74 66 68 70 79 77 76 83 72 78 87 76 79 91 83 93 88 88 85 96 89 92 87 94 91 101...

output:

721593337.206535458564758
38324.000000000000000
2980288.924050632864237
68272.000000000000000
71661.000000000000000
721634216.523173809051514
721675103.659430503845215
446225.099999999976717
306580.000000000000000
287033.333333333313931
260023.500000000000000
220046.000000000000000
482979.8888888888...

result:

ok 50000 numbers

Test #55:

score: 40
Accepted
time: 41ms
memory: 8116kb

input:

50000
1 1 1 3 4 3 7 8 6 7 8 11 8 1 9 5 15 14 9 20 12 17 21 12 17 15 17 20 16 19 31 21 22 29 24 25 27 36 32 29 33 29 37 43 43 43 42 46 42 43 46 49 50 51 42 47 55 53 47 52 49 51 55 57 54 57 66 57 60 60 65 72 59 72 63 74 63 68 75 79 67 71 79 77 72 80 83 86 84 77 77 80 86 81 90 89 88 91 93 86 93 102 98 ...

output:

724780675.813050746917725
10182.000000000000000
724822459.506686925888062
67517.666666666671517
172802.600000000005821
83802.500000000000000
724864291.657828927040100
724906158.895609021186829
724948033.943843841552734
99578.000000000000000
110474.500000000000000
342190.250000000000000
112340.000000...

result:

ok 50000 numbers

Test #56:

score: 40
Accepted
time: 41ms
memory: 7848kb

input:

50000
1 2 2 2 5 1 5 6 9 8 3 12 2 2 12 2 8 9 9 16 14 19 22 17 24 25 19 19 25 16 29 22 20 22 34 22 23 36 39 33 31 34 38 32 31 40 38 37 40 50 41 46 51 49 47 46 52 55 47 60 54 51 61 56 59 61 67 56 61 61 61 68 65 61 69 64 66 78 77 68 71 80 76 70 73 85 77 83 89 76 85 82 92 81 83 84 95 87 98 98 99 91 90 90...

output:

681227484.914407610893250
681269262.982088446617126
207865019.857142865657806
59869.000000000000000
681287107.945210695266724
681328908.802380561828613
89981.000000000000000
461930866.500000000000000
681370720.699993133544922
100049.000000000000000
110653.000000000000000
242500671.000000000000000
15...

result:

ok 50000 numbers

Test #57:

score: 40
Accepted
time: 41ms
memory: 8276kb

input:

50000
1 1 3 3 3 6 3 5 5 7 2 10 9 14 10 3 17 7 6 20 16 15 13 11 14 15 16 26 21 24 27 23 20 24 24 29 32 34 25 28 36 41 42 41 32 46 35 37 35 39 48 49 48 53 47 46 57 51 53 55 50 55 53 63 59 64 65 56 57 59 69 63 66 74 65 63 68 73 75 74 73 80 82 77 82 83 73 85 81 77 88 87 92 84 85 88 92 97 97 95 92 89 101...

output:

725863580.764705896377563
253390640.000000000000000
732101026.818181872367859
56033110.000000000000000
735122685.111111164093018
729796099.600000023841858
558773682.000000000000000
452733508.000000000000000
712062358.333333373069763
753952374.750000000000000
900828449.000000000000000
369618360.00000...

result:

ok 50000 numbers

Test #58:

score: 40
Accepted
time: 42ms
memory: 7324kb

input:

50000
1 2 2 2 4 6 1 5 3 1 6 12 12 2 2 4 12 17 19 2 19 20 2 18 11 19 20 19 19 18 9 15 1 26 5 13 18 33 15 6 35 33 19 36 3 46 24 15 44 34 18 17 31 35 17 23 41 55 18 59 20 39 38 45 54 56 38 21 29 37 71 42 38 64 72 46 40 51 71 68 55 62 58 73 64 78 75 87 73 72 90 58 92 57 61 52 52 64 82 84 72 71 89 59 67 ...

output:

701457322.214285731315613
740293535.250000000000000
491323519.000000000000000
694288040.545454502105713
448059556.500000000000000
726085281.000000000000000
905996078.000000000000000
801580231.000000000000000
892797775.000000000000000
395307105.000000000000000
708069106.625000000000000
687958201.7999...

result:

ok 50000 numbers

Test #59:

score: 40
Accepted
time: 45ms
memory: 7204kb

input:

50000
1 1 1 4 2 6 6 8 5 7 2 3 12 4 11 14 13 1 8 15 7 21 6 23 8 9 23 11 4 18 25 26 25 31 26 24 20 31 35 20 35 31 2 6 6 17 36 22 7 34 42 14 16 18 53 8 25 11 57 49 52 29 63 31 47 58 51 40 39 24 65 58 55 37 36 71 36 59 70 45 51 33 53 45 71 84 43 59 43 43 73 79 63 47 77 70 74 51 67 91 73 56 67 64 73 66 8...

output:

825756805.767396926879883
2879204.212121211923659
13413401.921568622812629
825841690.302734851837158
61057.500000000000000
2968921.468750000000000
3063094.129032257944345
704570.555555555503815
195440.000000000000000
73781.000000000000000
3163463.100000000093132
1586497.333333333255723
13545981.4851...

result:

ok 50000 numbers

Test #60:

score: 40
Accepted
time: 40ms
memory: 7300kb

input:

50000
1 1 3 3 3 3 7 4 2 9 9 11 9 13 12 11 17 3 4 16 12 1 17 6 25 17 24 26 1 7 20 3 13 11 25 26 37 26 37 18 5 4 9 32 19 44 38 27 7 10 10 41 53 39 34 36 42 52 16 25 41 33 59 20 25 18 61 26 29 26 45 34 24 67 26 49 65 59 69 39 76 47 41 47 71 63 60 68 61 68 61 66 78 72 89 74 58 76 65 56 88 102 55 94 57 8...

output:

825405139.677209973335266
670829.428571428521536
825491035.962533950805664
825576942.290173649787903
1275289.000000000000000
3389618.972972972784191
444271.666666666686069
144447.000000000000000
61405051.296296298503876
768252.599999999976717
64588657.000000000000000
1410654.125000000000000
1150211....

result:

ok 50000 numbers

Test #61:

score: 40
Accepted
time: 45ms
memory: 7204kb

input:

50000
1 2 3 2 2 4 3 7 5 3 6 7 11 4 10 7 4 11 12 6 3 17 21 14 3 8 20 6 13 17 6 6 7 23 5 16 34 7 1 20 34 4 26 19 22 16 22 32 44 26 23 14 21 44 29 15 22 24 44 52 42 31 60 33 63 60 41 49 48 60 51 24 40 59 62 69 68 37 56 52 48 63 59 72 47 64 59 74 67 48 64 57 59 92 73 50 94 50 64 70 65 64 67 93 59 59 81 ...

output:

768290893.322121977806091
768377615.709109544754028
768398946.438771009445190
884050573.000000000000000
802567934.000000000000000
469847672.399999976158142
327521584.416666686534882
355204.500000000000000
226358.000000000000000
330457278.000000000000000
282059192.500000000000000
552128974.5000000000...

result:

ok 50000 numbers

Test #62:

score: 40
Accepted
time: 46ms
memory: 7320kb

input:

50000
1 1 3 4 1 2 1 5 5 3 8 11 5 2 5 3 2 2 16 14 12 21 17 21 18 7 12 20 24 19 25 5 8 1 29 17 36 29 39 23 40 12 33 35 15 40 24 20 13 23 3 6 33 32 18 45 31 54 48 11 47 18 40 44 45 31 44 36 32 33 63 70 60 68 70 69 28 37 58 31 64 42 45 46 42 47 84 48 87 87 48 48 89 89 66 66 83 96 85 74 57 59 60 80 59 62...

output:

753851821.166666626930237
668632062.796875119209290
887662943.000000000000000
715307184.799999952316284
782690121.000000000000000
886918512.000000000000000
249813213.000000000000000
714025645.000000000000000
233172989.000000000000000
922750594.000000000000000
774907023.000000000000000
845317284.0000...

result:

ok 50000 numbers

Test #63:

score: 40
Accepted
time: 49ms
memory: 6840kb

input:

50000
1 1 3 1 4 1 5 1 7 1 9 11 12 5 8 15 1 10 12 17 17 2 3 4 18 21 6 20 18 28 26 28 1 3 32 5 17 32 10 21 40 23 27 14 3 6 16 45 36 21 36 27 51 34 52 21 50 9 10 3 37 42 27 61 36 14 25 32 2 1 25 32 40 71 5 65 30 74 58 31 59 40 40 13 48 77 14 65 53 77 27 52 78 37 26 83 23 78 95 15 92 6 30 34 47 67 50 69...

output:

901951603.111111164093018
939637957.500000000000000
933802636.000000000000000
816014947.580645203590393
995461141.000000000000000
829205237.622641563415527
800648794.666666626930237
829926939.965517282485962
838950727.531531572341919
809656687.750000000000000
816265667.590909123420715
842745436.5000...

result:

ok 50000 numbers

Test #64:

score: 40
Accepted
time: 38ms
memory: 6544kb

input:

50000
1 2 3 1 2 3 1 2 9 5 2 12 3 2 7 15 4 15 8 3 11 15 2 22 9 5 20 7 1 29 10 10 16 19 34 29 7 6 27 18 8 33 8 37 38 7 2 44 40 47 46 50 6 1 42 41 54 39 21 35 44 46 11 18 18 57 24 43 62 63 65 68 16 24 16 43 59 67 67 75 21 8 62 57 44 36 52 26 10 41 30 73 4 88 51 36 20 65 27 92 89 101 45 38 47 39 94 60 5...

output:

633723546.258620738983154
643127487.345454573631287
626455958.117948770523071
629803482.128205180168152
623134669.450000047683716
656528160.700000047683716
626313086.846153855323792
632579691.458333134651184
626287620.671641826629639
629914244.054545402526855
623766689.538461565971375
628698528.7843...

result:

ok 50000 numbers

Test #65:

score: 40
Accepted
time: 46ms
memory: 6668kb

input:

50000
1 1 1 1 5 1 2 1 6 8 7 8 3 4 13 10 14 12 7 17 13 7 9 21 19 1 3 13 7 3 14 7 19 7 18 26 29 2 35 11 30 3 42 25 18 23 18 20 21 15 46 10 35 28 44 55 17 10 26 30 21 21 16 41 13 61 20 53 36 32 68 49 73 46 15 59 75 57 59 37 60 40 75 22 61 10 15 46 80 28 67 24 19 60 34 94 43 43 4 72 29 45 29 46 48 19 37...

output:

651110072.888888835906982
613997859.385321140289307
641609873.414285659790039
618478919.964705824851990
613302520.188925027847290
614849359.594594597816467
633734586.299999952316284
614442940.450000047683716
655942871.968253970146179
621243361.435897469520569
562467009.875968933105469
630093669.5689...

result:

ok 50000 numbers

Test #66:

score: 40
Accepted
time: 43ms
memory: 6708kb

input:

50000
1 1 1 3 1 1 6 2 4 10 2 6 6 11 11 11 6 11 10 20 1 20 5 15 11 24 11 24 4 26 19 23 29 14 24 2 3 21 3 34 30 41 8 33 25 43 14 6 43 19 20 28 33 12 55 29 1 30 3 17 29 25 54 34 22 33 18 57 3 56 42 12 14 61 11 42 35 39 51 20 58 36 28 67 5 23 52 65 59 68 7 61 88 52 74 7 31 66 19 33 82 2 102 87 98 93 90 ...

output:

721192597.409090876579285
713888175.357142806053162
698075236.200000047683716
714617007.878048777580261
710842318.318181872367859
756738964.062500000000000
660494943.923076868057251
649846021.120689630508423
632481327.184782624244690
729587591.576923131942749
786801772.777777791023254
722544645.9444...

result:

ok 50000 numbers

Test #67:

score: 40
Accepted
time: 49ms
memory: 7104kb

input:

50000
1 1 1 1 1 2 3 8 2 5 10 7 7 11 9 8 12 7 6 15 20 11 2 11 23 4 5 3 15 26 23 1 14 23 3 27 6 25 32 20 9 17 16 42 27 8 43 40 8 28 9 17 2 5 20 44 7 58 45 25 36 22 2 61 34 8 14 43 10 50 5 48 3 22 59 57 12 2 36 8 31 62 78 49 64 19 51 64 37 3 1 82 69 48 65 44 97 59 93 60 10 21 65 75 71 31 35 95 56 92 22...

output:

887282016.411764740943909
858624524.157894730567932
843241926.774999976158142
803954793.250000000000000
914224170.777777791023254
839683888.931034445762634
842493264.000000000000000
849695227.928571462631226
861265724.772727251052856
983738870.000000000000000
840169391.733333349227905
885056239.6666...

result:

ok 50000 numbers

Subtask #4:

score: 40
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #68:

score: 40
Accepted
time: 187ms
memory: 23332kb

input:

200000
1 2 2 1 1 3 7 1 8 1 9 9 9 9 7 11 10 6 9 11 7 14 21 24 17 6 26 3 19 17 17 19 11 5 15 5 18 5 29 38 35 8 16 25 1 43 45 22 26 3 48 41 39 5 27 27 32 51 23 12 17 47 47 20 38 39 19 28 22 41 13 4 11 60 34 67 34 6 44 4 73 52 60 10 46 68 39 1 19 28 42 83 28 7 52 77 55 95 37 57 4 44 40 32 11 76 37 38 39...

output:

989409261.823529362678528
983299539.007751941680908
985470727.935483813285828
974094728.641509413719177
990050386.913043498992920
988282659.192307710647583
992853584.000000000000000
979067566.827906966209412
983658629.471615672111511
981025883.752577304840088
990982346.950000047683716
977745667.4210...

result:

ok 200000 numbers

Test #69:

score: 40
Accepted
time: 182ms
memory: 23180kb

input:

200000
1 2 1 3 2 1 3 6 4 6 6 6 10 2 11 13 2 1 13 14 10 22 20 23 10 1 1 15 13 25 30 30 2 1 25 23 37 38 20 28 26 24 28 34 44 29 8 48 30 37 25 47 27 24 42 37 44 6 29 53 2 20 25 20 29 4 33 64 64 7 27 22 10 64 72 20 11 62 65 66 73 4 53 18 35 15 33 8 28 30 27 10 84 19 7 13 65 93 52 86 42 11 36 39 89 92 29...

output:

970287546.133786797523499
968385353.775691747665405
968415678.582677125930786
970791288.104477643966675
970006594.086956501007080
968426164.385836362838745
967423702.125000000000000
968137622.809917330741882
965558185.966666698455811
970671309.137404561042786
966402789.391061425209045
969219852.2153...

result:

ok 200000 numbers

Test #70:

score: 40
Accepted
time: 185ms
memory: 23680kb

input:

200000
1 2 2 1 2 5 1 6 1 8 8 5 10 7 9 2 2 16 14 17 8 13 11 18 25 6 18 26 5 3 17 26 12 16 23 3 18 23 18 38 26 42 38 31 18 34 20 15 5 17 41 3 46 40 7 29 9 48 30 42 47 36 23 27 60 37 52 49 30 29 62 54 59 9 4 70 70 18 35 35 63 71 11 38 62 12 28 75 13 50 73 85 20 45 28 26 54 51 37 89 93 68 81 17 22 50 5 ...

output:

968831648.788583517074585
968863354.055016160011292
969495937.669354796409607
967975078.353448271751404
967549960.427561879158020
968486149.361445784568787
968177992.609137058258057
969792162.056451559066772
968823471.057591676712036
967817938.263852238655090
967036539.344262242317200
967347608.6149...

result:

ok 200000 numbers

Test #71:

score: 40
Accepted
time: 188ms
memory: 23440kb

input:

200000
1 2 1 4 2 4 2 2 8 1 4 2 3 10 12 13 12 13 11 19 12 2 17 24 22 24 21 7 17 6 16 14 28 1 24 12 25 22 33 33 12 27 21 5 12 40 26 42 12 34 10 13 48 45 22 44 2 11 20 8 2 58 61 3 16 22 65 12 13 14 32 22 17 55 22 38 24 12 65 24 17 22 12 58 52 5 9 63 11 24 68 19 9 87 33 85 3 19 7 41 73 15 56 70 21 28 96...

output:

973235985.692660570144653
979754359.648648619651794
968430371.419047594070435
973724075.411111116409302
967775588.931818127632141
968058153.600000023841858
981567916.966666698455811
969320645.373494029045105
966678197.066666722297668
970042423.089473724365234
969886460.290322542190552
973553963.7767...

result:

ok 200000 numbers

Test #72:

score: 40
Accepted
time: 187ms
memory: 21308kb

input:

200000
1 1 3 2 5 6 7 7 4 1 11 12 2 2 9 6 3 17 9 19 2 16 4 22 13 4 12 8 25 10 12 12 26 13 17 34 28 8 16 8 9 31 40 41 7 36 12 12 2 41 26 12 48 23 16 38 50 19 30 31 3 50 41 56 54 29 57 3 59 63 52 23 12 49 48 75 67 22 38 68 65 80 72 29 38 15 53 43 54 29 21 16 15 91 80 26 56 39 42 44 61 98 31 82 75 10 94...

output:

985087677.297169804573059
983472922.558635354042053
984158593.262032032012939
991651977.538461565971375
983991056.654205560684204
984582197.521072745323181
985021725.488888859748840
987109686.038461565971375
985014115.483870983123779
988570762.347826123237610
990861240.409090876579285
992234689.2222...

result:

ok 200000 numbers

Test #73:

score: 40
Accepted
time: 190ms
memory: 18660kb

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:

821234508.000000000000000
793175890.029761910438538
880595059.750000000000000
786454657.063291192054749
800712405.955555558204651
931940817.333333373069763
794462114.622950792312622
769434758.366197228431702
794238250.342857122421265
975473172.000000000000000
807911176.000000000000000
991596197.0000...

result:

ok 200000 numbers

Test #74:

score: 40
Accepted
time: 160ms
memory: 14104kb

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:

647203459.206466794013977
636117177.109595656394958
647455680.072096705436707
520414155.885964930057526
636427172.022904515266418
647708095.370370388031006
406705400.847391545772552
462784400.841053128242493
520667884.141882002353668
578516072.365675330162048
636737461.199414968490601
647960702.0752...

result:

ok 200000 numbers

Test #75:

score: 40
Accepted
time: 157ms
memory: 14028kb

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:

647637977.731982827186584
635858921.976109266281128
647890369.231099009513855
521516257.217836260795593
636169096.203414678573608
648142956.350877165794373
406515564.621832370758057
463701021.621160387992859
521770528.258410513401031
579482973.737688899040222
636479570.850658893585205
648395737.6388...

result:

ok 200000 numbers

Test #76:

score: 40
Accepted
time: 161ms
memory: 14072kb

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:

647332250.999122858047485
637831525.579545378684998
647901937.166813731193542
531530356.442148745059967
638738816.204836368560791
648474279.940812706947327
432659345.443333327770233
476207754.469135820865631
531604570.139310359954834
582784516.940813779830933
639811780.729729771614075
649062747.2970...

result:

ok 200000 numbers

Test #77:

score: 40
Accepted
time: 201ms
memory: 18036kb

input:

200000
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52...

output:

789569726.000000000000000
769658462.070671319961548
777194307.117647051811218
769732044.914285659790039
773697696.844660162925720
909145827.000000000000000
769800644.385542154312134
772274392.117187500000000
991813955.000000000000000
893472746.000000000000000
883822862.666666626930237
796314216.2500...

result:

ok 200000 numbers

Test #78:

score: 40
Accepted
time: 159ms
memory: 19852kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

998015287.181585669517517
598438798.000000000000000
514316816.000000000000000
460896108.000000000000000
791140524.000000000000000
14315745.000000000000000
558076503.000000000000000
587089998.000000000000000
707162851.000000000000000
758801499.000000000000000
745101092.000000000000000
43417044.000000...

result:

ok 200000 numbers

Test #79:

score: 40
Accepted
time: 160ms
memory: 51544kb

input:

200000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

533424854.333333313465118
566152638.200000047683716
663852395.000000000000000
838102964.500000000000000
995834128.000000000000000
573986802.000000000000000
510078749.279999971389771
529400929.000000000000000
583795080.666666626930237
593098814.500000000000000
943550432.000000000000000
555772961.6666...

result:

ok 200000 numbers

Test #80:

score: 40
Accepted
time: 172ms
memory: 52336kb

input:

200000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

476465682.251747131347656
476468064.579465031623840
476470446.910296201705933
476472829.236455678939819
476475211.562043368816376
476477593.884629249572754
476479976.194732964038849
476482358.523700416088104
476484740.800059139728546
476487123.098901569843292
476489505.412867724895477
476491887.7450...

result:

ok 200000 numbers

Test #81:

score: 40
Accepted
time: 171ms
memory: 51128kb

input:

200000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

475615719.749982833862305
475618097.837682008743286
475620475.940727233886719
475622854.057363688945770
475625232.186661541461945
475627610.330566048622131
475629988.474692046642303
475632366.642435312271118
475634744.822035670280457
475637122.990462362766266
475639501.160925865173340
475641879.3541...

result:

ok 200000 numbers

Test #82:

score: 40
Accepted
time: 170ms
memory: 51960kb

input:

200000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

476228346.453374743461609
476230727.597837746143341
476233108.757327318191528
476235489.928298711776733
476237871.091686606407166
476240252.269646525382996
476242633.432422757148743
476245014.590430438518524
625111488.000000000000000
476246651.382271945476532
476249032.550367295742035
476251413.6612...

result:

ok 200000 numbers

Test #83:

score: 40
Accepted
time: 160ms
memory: 51128kb

input:

200000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

476314407.977417409420013
476316729.186548590660095
476322063.915351629257202
476345325.145853817462921
489120592.750000000000000
529910891.333333313465118
539717849.000000000000000
705420635.000000000000000
476356967.002104461193085
476357274.955490767955780
515589436.333333313465118
565707254.2500...

result:

ok 200000 numbers

Test #84:

score: 40
Accepted
time: 168ms
memory: 21684kb

input:

200000
1 2 2 3 3 6 2 3 6 6 11 11 6 3 9 7 7 4 5 7 8 19 23 24 21 12 26 17 22 27 24 24 30 25 35 31 28 28 39 30 31 28 38 41 36 34 41 38 37 46 37 45 46 40 50 46 45 54 54 47 60 62 60 53 55 64 64 56 55 69 60 60 61 70 72 71 67 73 76 75 77 72 70 83 81 73 83 79 82 77 81 79 93 91 91 92 89 96 92 91 99 90 91 93 ...

output:

650541094.142857193946838
749624196.200000047683716
666714166.000000000000000
833209737.500000000000000
551061149.500000000000000
630673722.265486717224121
668780929.000000000000000
612275804.000000000000000
509708870.500000000000000
134239151.000000000000000
604377235.555555582046509
631617413.4285...

result:

ok 200000 numbers

Test #85:

score: 40
Accepted
time: 169ms
memory: 20892kb

input:

200000
1 2 3 1 2 6 3 6 8 9 3 5 2 4 7 4 10 12 19 19 12 16 21 18 14 21 16 26 21 25 19 32 31 25 27 33 33 36 28 36 41 39 35 40 38 40 44 34 38 50 50 39 40 46 51 42 53 50 51 56 47 58 57 53 53 60 62 61 65 67 59 62 67 68 72 76 71 74 67 71 75 73 75 75 80 78 87 86 86 83 79 83 90 91 83 93 83 86 94 87 87 88 93 ...

output:

724882127.138093113899231
724892473.339719414710999
724902819.834000587463379
38785.000000000000000
34005.000000000000000
383321.444444444437977
397661.458333333313931
109279.600000000005821
34723.000000000000000
117643.666666666671517
35354.000000000000000
724913166.614982724189758
42864.0000000000...

result:

ok 200000 numbers

Test #86:

score: 40
Accepted
time: 174ms
memory: 20816kb

input:

200000
1 1 1 2 1 4 4 2 3 6 10 1 12 4 9 8 4 4 15 11 8 21 21 10 22 21 14 19 28 17 29 30 30 29 21 33 24 38 27 26 28 42 33 39 43 45 40 41 40 41 41 48 51 53 41 45 50 47 52 55 54 57 53 58 53 65 54 57 62 64 68 60 62 65 65 74 67 78 76 74 72 69 82 75 79 76 86 84 86 79 86 86 79 84 81 89 91 90 88 100 98 90 90 ...

output:

724620326.695640683174133
26431.666666666667879
110612.769230769234127
250974.708333333343035
14165.000000000000000
724630700.467393279075623
20050.000000000000000
262537.299999999988358
37453.000000000000000
119041.583333333328483
724641074.321830987930298
127135.000000000000000
34691.0000000000000...

result:

ok 200000 numbers

Test #87:

score: 40
Accepted
time: 174ms
memory: 22024kb

input:

200000
1 2 1 3 5 4 7 8 1 2 8 5 2 12 4 3 11 18 14 19 7 11 15 13 21 14 19 16 18 22 28 29 20 26 23 31 35 26 36 39 28 37 43 35 39 34 36 39 35 48 43 43 52 47 52 44 53 53 48 48 60 54 62 64 51 63 56 65 63 67 60 59 65 60 67 67 69 71 72 66 68 81 80 84 79 84 80 74 78 78 82 78 86 94 92 87 83 91 90 92 95 89 93 ...

output:

712661339.330436468124390
712671758.328599214553833
49458.199999999997090
231149246.333333343267441
57455.000000000000000
27796.000000000000000
346712067.000000000000000
693392277.000000000000000
43044.000000000000000
43571.000000000000000
712682177.914935588836670
64500.666666666664241
73556.000000...

result:

ok 200000 numbers

Test #88:

score: 40
Accepted
time: 172ms
memory: 21852kb

input:

200000
1 2 1 1 5 2 1 8 1 10 4 2 9 12 9 6 15 9 6 12 17 20 13 17 20 14 20 22 24 19 27 23 27 21 31 23 24 28 29 39 30 38 40 36 38 44 45 42 37 49 48 52 53 44 42 45 43 52 58 46 58 55 52 58 54 55 62 66 64 56 69 70 68 72 66 73 69 77 72 69 71 82 79 80 71 83 81 87 82 83 77 87 89 90 85 91 97 95 99 95 88 94 95 ...

output:

753594982.666666626930237
649363904.191489338874817
213014381.000000000000000
914560229.000000000000000
626945864.000000000000000
682152190.000000000000000
417561332.000000000000000
655329024.600000023841858
911473399.000000000000000
757712263.000000000000000
9379130.000000000000000
611799984.000000...

result:

ok 200000 numbers

Test #89:

score: 40
Accepted
time: 182ms
memory: 20036kb

input:

200000
1 2 2 4 2 5 3 4 6 1 5 2 1 9 2 7 17 2 12 2 6 22 3 6 18 25 27 27 18 16 17 1 15 11 32 28 5 29 12 39 16 23 18 9 21 38 14 17 17 36 18 21 36 8 16 30 44 54 29 46 18 32 22 62 44 40 60 35 34 68 67 65 57 49 28 75 43 70 49 49 61 62 74 65 55 74 52 43 43 54 53 85 55 54 68 83 65 61 75 59 96 84 102 75 105 7...

output:

776498470.545454502105713
845367821.166666626930237
804421351.000000000000000
993991162.500000000000000
997691534.000000000000000
748740642.833333373069763
701546392.299999952316284
990925095.000000000000000
849377614.000000000000000
841832931.000000000000000
821477508.000000000000000
628952586.7894...

result:

ok 200000 numbers

Test #90:

score: 40
Accepted
time: 158ms
memory: 17496kb

input:

200000
1 2 2 4 5 4 5 8 8 1 9 4 2 10 6 1 14 14 17 17 12 11 18 5 18 2 21 4 17 19 5 24 1 28 32 29 25 11 23 32 34 24 12 22 2 9 42 44 23 42 38 29 23 43 44 55 17 25 42 30 33 59 34 46 29 65 33 51 40 26 33 43 34 66 51 28 49 77 33 47 79 63 58 78 65 57 86 60 51 71 46 61 87 84 76 75 66 94 71 71 68 97 88 93 78 ...

output:

825602506.713792324066162
825623576.593557357788086
7868.000000000000000
825644647.626246213912964
2592841.307692307513207
42981.000000000000000
27514.000000000000000
2606301.465968586504459
2619862.031578947324306
42617.000000000000000
176798.000000000000000
2633679.641711229924113
43169.0000000000...

result:

ok 200000 numbers

Test #91:

score: 40
Accepted
time: 192ms
memory: 17152kb

input:

200000
1 2 1 1 5 3 4 7 6 1 4 8 10 5 3 1 5 12 13 8 21 15 17 23 7 15 1 1 2 24 31 28 27 14 24 9 31 28 38 33 13 8 33 40 27 26 35 3 44 46 2 32 33 5 54 48 47 32 55 59 28 26 62 57 59 22 55 19 62 41 49 38 24 59 63 47 57 54 41 79 62 56 61 56 55 46 59 84 59 82 78 87 79 63 91 82 97 74 83 75 82 85 100 74 58 103...

output:

825642231.009332418441772
825663402.708155870437622
825684581.174075722694397
417687.555555555620231
372505.000000000000000
198574.111111111124046
825705767.532512545585632
271163.500000000000000
92802.500000000000000
220311.875000000000000
48075.000000000000000
467746.625000000058208
116211.5000000...

result:

ok 200000 numbers

Test #92:

score: 40
Accepted
time: 169ms
memory: 17976kb

input:

200000
1 2 1 3 4 5 3 7 3 6 8 10 10 3 13 12 15 5 7 4 21 4 12 7 25 14 1 23 21 18 24 30 30 20 21 30 36 3 39 3 25 1 9 33 9 14 41 13 36 25 7 5 49 41 39 11 11 32 41 28 40 52 36 39 35 41 57 66 54 46 67 51 30 61 42 45 48 46 54 49 74 73 71 82 59 86 56 75 40 75 80 45 90 49 55 78 84 60 50 96 93 59 87 75 62 73 ...

output:

808351718.322351813316345
215820568.166666656732559
277479981.000000000000000
808373424.141542077064514
201341467.900000005960464
251410070.000000000000000
223710075.222222208976746
554938068.000000000000000
247989344.000000000000000
246649082.333333343267441
289761.250000000000000
376689.8888888888...

result:

ok 200000 numbers

Test #93:

score: 40
Accepted
time: 171ms
memory: 20020kb

input:

200000
1 1 3 3 2 2 2 5 3 3 11 9 3 1 10 14 6 12 18 11 9 22 6 9 1 6 25 13 9 4 28 5 1 11 28 8 34 33 1 3 7 24 2 38 26 13 18 46 47 18 23 13 4 36 8 41 17 41 34 30 55 15 31 41 55 21 67 66 29 33 45 41 42 25 59 74 42 40 33 78 64 62 62 63 61 61 73 65 45 63 66 62 93 88 67 92 61 55 73 70 87 93 70 87 58 57 69 65...

output:

887234856.666666626930237
476311884.000000000000000
917291902.000000000000000
479400032.250000000000000
900201530.000000000000000
563574207.500000000000000
407380253.000000000000000
391953584.000000000000000
621052278.885714292526245
822719473.000000000000000
680584622.000000000000000
997301535.0000...

result:

ok 200000 numbers

Test #94:

score: 40
Accepted
time: 198ms
memory: 17924kb

input:

200000
1 2 1 4 3 2 5 4 4 7 5 8 13 8 1 7 17 5 13 20 19 21 18 11 18 4 5 23 17 29 10 28 23 17 31 18 22 14 33 8 13 6 19 9 29 20 27 17 15 47 20 25 19 13 28 27 40 53 28 9 54 1 23 60 14 24 54 23 38 15 2 23 38 33 30 24 12 11 32 48 42 77 24 3 9 48 56 14 61 7 91 53 61 17 77 90 95 76 25 3 1 97 94 14 33 83 81 9...

output:

889004817.990196108818054
878169069.950000047683716
853644716.714285731315613
890420181.343434333801270
951380172.666666626930237
858995047.545454502105713
889405289.250000000000000
893269877.791666626930237
893488381.500000000000000
853784426.888888835906982
998241909.000000000000000
935190571.6666...

result:

ok 200000 numbers

Test #95:

score: 40
Accepted
time: 186ms
memory: 15972kb

input:

200000
1 1 1 1 2 2 1 4 7 9 6 10 13 13 9 1 2 8 15 6 9 3 21 14 17 20 9 28 3 24 27 20 14 3 28 22 27 13 24 12 14 11 9 2 2 30 4 31 40 43 7 42 39 5 32 2 22 47 5 5 38 50 6 18 15 35 32 51 54 30 15 26 68 35 6 45 2 18 66 70 59 32 50 55 26 9 47 18 52 69 60 89 11 61 95 55 51 39 71 27 38 81 12 69 64 91 105 69 48...

output:

653024367.685185194015503
651013523.236111164093018
660600636.522727251052856
631775125.512880444526672
617778213.972222208976746
632209182.706666707992554
650887426.000000000000000
688542982.222222208976746
633000986.013288974761963
662407841.673076868057251
635362403.622448921203613
616240421.6627...

result:

ok 200000 numbers

Test #96:

score: 40
Accepted
time: 187ms
memory: 16064kb

input:

200000
1 2 3 4 3 2 3 6 4 8 2 6 7 7 7 5 16 10 17 6 9 18 17 18 2 1 22 13 5 9 28 7 33 17 2 9 28 5 3 14 27 7 19 32 43 18 16 46 40 37 13 19 48 19 39 13 50 16 28 34 13 53 38 35 15 53 62 47 23 59 38 9 33 66 72 58 39 29 32 46 19 47 79 11 52 63 40 69 41 78 33 91 14 46 66 36 31 67 60 5 69 10 89 9 69 37 58 5 9...

output:

653977916.000000000000000
646617740.676880240440369
647692494.605882406234741
641729982.006802678108215
647232382.235954999923706
649773511.049180269241333
647724785.787401556968689
622547930.576470613479614
625337741.840909123420715
636830986.471153855323792
628197636.755555510520935
651730763.1707...

result:

ok 200000 numbers

Test #97:

score: 40
Accepted
time: 189ms
memory: 16364kb

input:

200000
1 1 3 2 3 2 6 7 2 4 8 7 9 5 2 3 1 1 2 10 9 13 12 19 19 17 16 27 7 20 31 2 28 13 31 18 11 15 10 27 35 10 35 3 33 26 16 32 49 32 49 49 5 41 44 37 21 32 4 58 28 15 18 16 52 28 17 43 8 33 42 28 60 42 32 60 7 51 63 65 14 25 11 66 13 31 19 34 62 14 9 63 86 77 92 66 59 58 31 67 72 85 64 31 72 21 49 ...

output:

676553361.004651188850403
681245951.345454573631287
660782319.538461565971375
658916168.919191956520081
631057602.183098554611206
675882926.586206912994385
689546834.774999976158142
643460543.375000000000000
713064626.750000000000000
668652803.357142806053162
659790856.931818127632141
635187547.7229...

result:

ok 200000 numbers

Test #98:

score: 40
Accepted
time: 199ms
memory: 17608kb

input:

200000
1 2 3 1 3 2 2 5 6 7 8 4 4 2 14 6 4 8 13 7 18 11 14 21 25 1 7 25 11 26 8 23 12 17 22 9 29 33 16 18 25 31 7 43 22 5 20 11 36 47 14 40 14 34 15 26 16 33 18 19 41 59 4 23 62 59 56 17 8 19 35 36 3 7 9 27 57 32 77 4 24 68 52 10 10 26 77 25 59 51 41 60 31 30 61 28 40 37 64 66 101 81 89 75 1 52 64 91...

output:

943028333.000000000000000
892565954.866666674613953
993830019.000000000000000
892921317.000000000000000
839909715.125000000000000
849552621.727272748947144
858745289.406250000000000
821243002.448979616165161
845491789.697368383407593
835031125.000000000000000
858129201.802816867828369
813630985.8947...

result:

ok 200000 numbers