QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#214827#6547. Bansheeucup-team180#AC ✓376ms13696kbC++1730.4kb2023-10-15 00:20:352023-10-15 00:20:36

Judging History

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

  • [2023-10-15 00:20:36]
  • 评测
  • 测评结果:AC
  • 用时:376ms
  • 内存:13696kb
  • [2023-10-15 00:20:35]
  • 提交

answer

#pragma region Macros
#ifdef noimi
#include "my_template.hpp"
#else
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <immintrin.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfenv>
#include <cfloat>
#include <chrono>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <immintrin.h>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <variant>

#ifdef noimi
#define oj_local(a, b) b
#else
#define oj_local(a, b) a
#endif

#define LOCAL if(oj_local(0, 1))
#define OJ if(oj_local(1, 0))

using namespace std;
using ll = long long;
using ull = unsigned long long int;
using i128 = __int128_t;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vc<T>>;
template <typename T> using vvvc = vector<vvc<T>>;
using vi = vc<int>;
using vl = vc<ll>;
using vpi = vc<pii>;
using vpl = vc<pll>;
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
template <typename T> int si(const T &x) { return x.size(); }
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); }
vi iota(int n) {
    vi a(n);
    return iota(a.begin(), a.end(), 0), a;
}
template <typename T> vi iota(const vector<T> &a, bool greater = false) {
    vi res(a.size());
    iota(res.begin(), res.end(), 0);
    sort(res.begin(), res.end(), [&](int i, int j) {
        if(greater) return a[i] > a[j];
        return a[i] < a[j];
    });
    return res;
}

// macros
#define overload5(a, b, c, d, e, name, ...) name
#define overload4(a, b, c, d, name, ...) name
#define endl '\n'
#define REP0(n) for(ll jidlsjf = 0; jidlsjf < n; ++jidlsjf)
#define REP1(i, n) for(ll i = 0; i < (n); ++i)
#define REP2(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP3(i, a, b, c) for(ll i = (a); i < (b); i += (c))
#define rep(...) overload4(__VA_ARGS__, REP3, REP2, REP1, REP0)(__VA_ARGS__)
#define per0(n) for(int jidlsjf = 0; jidlsjf < (n); ++jidlsjf)
#define per1(i, n) for(ll i = (n)-1; i >= 0; --i)
#define per2(i, a, b) for(ll i = (a)-1; i >= b; --i)
#define per3(i, a, b, c) for(ll i = (a)-1; i >= (b); i -= (c))
#define per(...) overload4(__VA_ARGS__, per3, per2, per1, per0)(__VA_ARGS__)
#define fore0(a) rep(a.size())
#define fore1(i, a) for(auto &&i : a)
#define fore2(a, b, v) for(auto &&[a, b] : v)
#define fore3(a, b, c, v) for(auto &&[a, b, c] : v)
#define fore4(a, b, c, d, v) for(auto &&[a, b, c, d] : v)
#define fore(...) overload5(__VA_ARGS__, fore4, fore3, fore2, fore1, fore0)(__VA_ARGS__)
#define setbits(j, n) for(ll iiiii = (n), j = lowbit(iiiii); iiiii; iiiii ^= 1 << j, j = lowbit(iiiii))
#define perm(v) for(bool permrepflag = true; (permrepflag ? exchange(permrepflag, false) : next_permutation(all(v)));)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define drop(s) cout << #s << endl, exit(0)
#define si(c) (int)(c).size()
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define lbg(c, x) distance((c).begin(), lower_bound(all(c), (x), greater{}))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define ubg(c, x) distance((c).begin(), upper_bound(all(c), (x), greater{}))
#define rng(v, l, r) v.begin() + (l), v.begin() + (r)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define SORT(v) sort(all(v))
#define REV(v) reverse(all(v))
#define UNIQUE(x) SORT(x), x.erase(unique(all(x)), x.end())
template <typename T = ll, typename S> T SUM(const S &v) { return accumulate(all(v), T(0)); }
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#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__))))
constexpr pii dx4[4] = {pii{1, 0}, pii{0, 1}, pii{-1, 0}, pii{0, -1}};
constexpr pii dx8[8] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

namespace yesno_impl {
const string YESNO[2] = {"NO", "YES"};
const string YesNo[2] = {"No", "Yes"};
const string yesno[2] = {"no", "yes"};
const string firstsecond[2] = {"second", "first"};
const string FirstSecond[2] = {"Second", "First"};
const string possiblestr[2] = {"impossible", "possible"};
const string Possiblestr[2] = {"Impossible", "Possible"};
void YES(bool t = 1) { cout << YESNO[t] << endl; }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { cout << YesNo[t] << endl; }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { cout << yesno[t] << endl; }
void no(bool t = 1) { yes(!t); }
void first(bool t = 1) { cout << firstsecond[t] << endl; }
void First(bool t = 1) { cout << FirstSecond[t] << endl; }
void possible(bool t = 1) { cout << possiblestr[t] << endl; }
void Possible(bool t = 1) { cout << Possiblestr[t] << endl; }
}; // namespace yesno_impl
using namespace yesno_impl;

#define INT(...)                                                                                                                                               \
    int __VA_ARGS__;                                                                                                                                           \
    IN(__VA_ARGS__)
#define INTd(...)                                                                                                                                              \
    int __VA_ARGS__;                                                                                                                                           \
    IN2(__VA_ARGS__)
#define LL(...)                                                                                                                                                \
    ll __VA_ARGS__;                                                                                                                                            \
    IN(__VA_ARGS__)
#define LLd(...)                                                                                                                                               \
    ll __VA_ARGS__;                                                                                                                                            \
    IN2(__VA_ARGS__)
#define STR(...)                                                                                                                                               \
    string __VA_ARGS__;                                                                                                                                        \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                                                                               \
    char __VA_ARGS__;                                                                                                                                          \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                                                                               \
    double __VA_ARGS__;                                                                                                                                        \
    IN(__VA_ARGS__)
#define VEC(type, name, size)                                                                                                                                  \
    vector<type> name(size);                                                                                                                                   \
    IN(name)
#define VECd(type, name, size)                                                                                                                                 \
    vector<type> name(size);                                                                                                                                   \
    IN2(name)
#define VEC2(type, name1, name2, size)                                                                                                                         \
    vector<type> name1(size), name2(size);                                                                                                                     \
    for(int i = 0; i < size; i++) IN(name1[i], name2[i])
#define VEC2d(type, name1, name2, size)                                                                                                                        \
    vector<type> name1(size), name2(size);                                                                                                                     \
    for(int i = 0; i < size; i++) IN2(name1[i], name2[i])
#define VEC3(type, name1, name2, name3, size)                                                                                                                  \
    vector<type> name1(size), name2(size), name3(size);                                                                                                        \
    for(int i = 0; i < size; i++) IN(name1[i], name2[i], name3[i])
#define VEC3d(type, name1, name2, name3, size)                                                                                                                 \
    vector<type> name1(size), name2(size), name3(size);                                                                                                        \
    for(int i = 0; i < size; i++) IN2(name1[i], name2[i], name3[i])
#define VEC4(type, name1, name2, name3, name4, size)                                                                                                           \
    vector<type> name1(size), name2(size), name3(size), name4(size);                                                                                           \
    for(int i = 0; i < size; i++) IN(name1[i], name2[i], name3[i], name4[i]);
#define VEC4d(type, name1, name2, name3, name4, size)                                                                                                          \
    vector<type> name1(size), name2(size), name3(size), name4(size);                                                                                           \
    for(int i = 0; i < size; i++) IN2(name1[i], name2[i], name3[i], name4[i]);
#define VV(type, name, h, w)                                                                                                                                   \
    vector<vector<type>> name(h, vector<type>(w));                                                                                                             \
    IN(name)
#define VVd(type, name, h, w)                                                                                                                                  \
    vector<vector<type>> name(h, vector<type>(w));                                                                                                             \
    IN2(name)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(string &a) { cin >> a; }
template <class T, class S> void scan(pair<T, S> &p) { scan(p.first), scan(p.second); }
template <class T> void scan(vector<T> &);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
void IN2() {}
template <class Head, class... Tail> void IN(Head &head, Tail &...tail) {
    scan(head);
    IN(tail...);
}
template <class Head, class... Tail> void IN2(Head &head, Tail &...tail) {
    scan(head);
    --head;
    IN2(tail...);
}

template <int p = -1> void pat() {}
template <int p = -1, class Head, class... Tail> void pat(Head &h, Tail &...tail) {
    h += p;
    pat<p>(tail...);
}

template <typename T, typename S> T ceil(T x, S y) {
    assert(y);
    return (y < 0 ? ceil(-x, -y) : (x > 0 ? (x + y - 1) / y : x / y));
}

template <typename T, typename S> T floor(T x, S y) {
    assert(y);
    return (y < 0 ? floor(-x, -y) : (x > 0 ? x / y : x / y - (x % y == 0 ? 0 : 1)));
}
template <typename T, typename S, typename U> U bigmul(const T &x, const S &y, const U &lim) { // clamp(x * y, -lim, lim)
    if(x < 0 and y < 0) return bigmul(-x, -y, lim);
    if(x < 0) return -bigmul(-x, y, lim);
    if(y < 0) return -bigmul(x, -y, lim);
    return y == 0 or x <= lim / y ? x * y : lim;
}
template <class T> T POW(T x, int n) {
    T res = 1;
    for(; n; n >>= 1, x *= x)
        if(n & 1) res *= x;
    return res;
}
template <class T, class S> T POW(T x, S n, const ll &mod) {
    T res = 1;
    x %= mod;
    for(; n; n >>= 1, x = x * x % mod)
        if(n & 1) res = res * x % mod;
    return res;
}
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
template <class T> vector<T> divisor(T x) {
    vector<T> ans;
    for(T i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
template <typename T> void zip(vector<T> &x) {
    vector<T> y = x;
    UNIQUE(y);
    for(int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); }
}
template <class S> void fold_in(vector<S> &v) {}
template <typename Head, typename... Tail, class S> void fold_in(vector<S> &v, Head &&a, Tail &&...tail) {
    for(auto e : a) v.emplace_back(e);
    fold_in(v, tail...);
}
template <class S> void renumber(vector<S> &v) {}
template <typename Head, typename... Tail, class S> void renumber(vector<S> &v, Head &&a, Tail &&...tail) {
    for(auto &&e : a) e = lb(v, e);
    renumber(v, tail...);
}
template <class S, class... Args> vector<S> zip(vector<S> &head, Args &&...args) {
    vector<S> v;
    fold_in(v, head, args...);
    sort(all(v)), v.erase(unique(all(v)), v.end());
    renumber(v, head, args...);
    return v;
}

template <typename S> void rearrange(const vector<S> &id) {}
template <typename S, typename T> void rearrange_exec(const vector<S> &id, vector<T> &v) {
    vector<T> w(v.size());
    rep(i, si(id)) w[i] = v[id[i]];
    v.swap(w);
}
// 並び替える順番, 並び替える vector 達
template <typename S, typename Head, typename... Tail> void rearrange(const vector<S> &id, Head &a, Tail &...tail) {
    rearrange_exec(id, a);
    rearrange(id, tail...);
}

template <typename T> vector<T> RUI(const vector<T> &v) {
    vector<T> res(v.size() + 1);
    for(int i = 0; i < v.size(); i++) res[i + 1] = res[i] + v[i];
    return res;
}
template <typename T> void zeta_supersetsum(vector<T> &f) {
    int n = f.size();
    for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b] += f[b | i];
}

template <typename T> void zeta_subsetsum(vector<T> &f) {
    int n = f.size();
    for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b | i] += f[b];
}
template <typename T> void mobius_subset(vector<T> &f) {
    int n = f.size();
    for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b] -= f[b | i];
}
template <typename T> void mobius_superset(vector<T> &f) {
    int n = f.size();
    for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b | i] -= f[b];
}
// 反時計周りに 90 度回転
template <typename T> void rot(vector<vector<T>> &v) {
    if(empty(v)) return;
    int n = v.size(), m = v[0].size();
    vector<vector<T>> res(m, vector<T>(n));
    rep(i, n) rep(j, m) res[m - 1 - j][i] = v[i][j];
    v.swap(res);
}

vector<int> counter(const vector<int> &v, int max_num = -1) {
    if(max_num == -1) max_num = MAX(v);
    vector<int> res(max_num + 1);
    fore(e, v) res[e]++;
    return res;
}

// x in [l, r)
template <class T, class S> bool inc(const T &x, const S &l, const S &r) { return l <= x and x < r; }
template <class T, class S> bool inc(const T &x, const pair<S, S> &p) { return p.first <= x and x < p.second; }

// 便利関数
constexpr ll ten(int n) { return n == 0 ? 1 : ten(n - 1) * 10; }
constexpr ll tri(ll n) { return n * (n + 1) / 2; }
// l + ... + r
constexpr ll tri(ll l, ll r) { return (l + r) * (r - l + 1) / 2; }
ll max(int x, ll y) { return max((ll)x, y); }
ll max(ll x, int y) { return max(x, (ll)y); }
int min(int x, ll y) { return min((ll)x, y); }
int min(ll x, int y) { return min(x, (ll)y); }
// bit 演算系
#define bit(i) (1LL << i)       // (1 << i)
#define test(b, i) (b >> i & 1) // b の i bit 目が立っているか
ll pow2(int i) { return 1LL << i; }
int topbit(signed t) { return t == 0 ? -1 : 31 - __builtin_clz(t); }
int topbit(ll t) { return t == 0 ? -1 : 63 - __builtin_clzll(t); }
int lowbit(signed a) { return a == 0 ? 32 : __builtin_ctz(a); }
int lowbit(ll a) { return a == 0 ? 64 : __builtin_ctzll(a); }
// int allbit(int n) { return (1 << n) - 1; }
constexpr ll mask(int n) { return (1LL << n) - 1; }
// int popcount(signed t) { return __builtin_popcount(t); }
// int popcount(ll t) { return __builtin_popcountll(t); }
int popcount(uint64_t t) { return __builtin_popcountll(t); }
static inline uint64_t popcount64(uint64_t x) {
    uint64_t m1 = 0x5555555555555555ll;
    uint64_t m2 = 0x3333333333333333ll;
    uint64_t m4 = 0x0F0F0F0F0F0F0F0Fll;
    uint64_t h01 = 0x0101010101010101ll;

    x -= (x >> 1) & m1;
    x = (x & m2) + ((x >> 2) & m2);
    x = (x + (x >> 4)) & m4;

    return (x * h01) >> 56;
}
bool ispow2(int i) { return i && (i & -i) == i; }

ll rnd(ll l, ll r) { //[l, r)
#ifdef noimi
    static mt19937_64 gen;
#else
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
#endif
    return uniform_int_distribution<ll>(l, r - 1)(gen);
}
ll rnd(ll n) { return rnd(0, n); }

template <class t> void random_shuffle(vc<t> &a) { rep(i, si(a)) swap(a[i], a[rnd(0, i + 1)]); }

int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}

template <class T, class S> pair<T, S> operator-(const pair<T, S> &x) { return pair<T, S>(-x.first, -x.second); }
template <class T, class S> pair<T, S> operator-(const pair<T, S> &x, const pair<T, S> &y) { return pair<T, S>(x.fi - y.fi, x.se - y.se); }
template <class T, class S> pair<T, S> operator+(const pair<T, S> &x, const pair<T, S> &y) { return pair<T, S>(x.fi + y.fi, x.se + y.se); }
template <class T> pair<T, T> operator&(const pair<T, T> &l, const pair<T, T> &r) { return pair<T, T>(max(l.fi, r.fi), min(l.se, r.se)); }
template <class T, class S> pair<T, S> operator+=(pair<T, S> &l, const pair<T, S> &r) { return l = l + r; }
template <class T, class S> pair<T, S> operator-=(pair<T, S> &l, const pair<T, S> &r) { return l = l - r; }
template <class T> bool intersect(const pair<T, T> &l, const pair<T, T> &r) { return (l.se < r.se ? r.fi < l.se : l.fi < r.se); }

template <class T> vector<T> &operator++(vector<T> &v) {
    fore(e, v) e++;
    return v;
}
template <class T> vector<T> operator++(vector<T> &v, int) {
    auto res = v;
    fore(e, v) e++;
    return res;
}
template <class T> vector<T> &operator--(vector<T> &v) {
    fore(e, v) e--;
    return v;
}
template <class T> vector<T> operator--(vector<T> &v, int) {
    auto res = v;
    fore(e, v) e--;
    return res;
}
template <class T> void connect(vector<T> &l, const vector<T> &r) { fore(e, r) l.eb(e); }
template <class T> vector<T> operator+(const vector<T> &l, const vector<T> &r) {
    vector<T> res(max(si(l), si(r)));
    rep(i, si(l)) res[i] += l[i];
    rep(i, si(r)) res[i] += r[i];
    return res;
}
template <class T> vector<T> operator-(const vector<T> &l, const vector<T> &r) {
    vector<T> res(max(si(l), si(r)));
    rep(i, si(l)) res[i] += l[i];
    rep(i, si(r)) res[i] -= r[i];
    return res;
}
template <class T> vector<T> &operator+=(const vector<T> &l, const vector<T> &r) {
    if(si(l) < si(r)) l.resize(si(r));
    rep(i, si(r)) l[i] += r[i];
    return l;
}
template <class T> vector<T> &operator-=(const vector<T> &l, const vector<T> &r) {
    if(si(l) < si(r)) l.resize(si(r));
    rep(i, si(r)) l[i] -= r[i];
    return l;
}
template <class T> vector<T> &operator+=(vector<T> &v, const T &x) {
    fore(e, v) e += x;
    return v;
}
template <class T> vector<T> &operator-=(vector<T> &v, const T &x) {
    fore(e, v) e -= x;
    return v;
}

template <typename T> struct edge {
    int from, to;
    T cost;
    int id;
    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    edge(int from, int to, T cost, int id) : from(from), to(to), cost(cost), id(id) {}
    constexpr bool operator<(const edge<T> &rhs) const noexcept { return cost < rhs.cost; }
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }
    operator int() const { return to; }
    friend ostream operator<<(ostream &os, const edge &e) { return os << e.to; }
};
template <typename T> using Edges = vector<edge<T>>;

template <typename T = int> Edges<T> read_edges(int m, bool weighted = false) {
    Edges<T> res;
    res.reserve(m);
    for(int i = 0; i < m; i++) {
        int u, v, c = 0;
        scan(u), scan(v), u--, v--;
        if(weighted) scan(c);
        res.eb(u, v, c, i);
    }
    return res;
}

using Tree = vector<vector<int>>;
using Graph = vector<vector<int>>;
template <class T> using Wgraph = vector<vector<edge<T>>>;
Graph getG(int n, int m = -1, bool directed = false, int margin = 1) {
    Tree res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        cin >> a >> b;
        a -= margin, b -= margin;
        res[a].emplace_back(b);
        if(!directed) res[b].emplace_back(a);
    }
    return res;
}
Graph getTreeFromPar(int n, int margin = 1) {
    Graph res(n);
    for(int i = 1; i < n; i++) {
        int a;
        cin >> a;
        res[a - margin].emplace_back(i);
    }
    return res;
}
template <class T> Wgraph<T> getWg(int n, int m = -1, bool directed = false, int margin = 1) {
    Wgraph<T> res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        T c;
        scan(a), scan(b), scan(c);
        a -= margin, b -= margin;
        res[a].emplace_back(b, c);
        if(!directed) res[b].emplace_back(a, c);
    }
    return res;
}
void add(Graph &G, int x, int y) { G[x].eb(y), G[y].eb(x); }
template <class S, class T> void add(Wgraph<S> &G, int x, int y, T c) { G[x].eb(y, c), G[y].eb(x, c); }

#define TEST                                                                                                                                                   \
    INT(testcases);                                                                                                                                            \
    while(testcases--)

i128 abs(const i128 &x) { return x > 0 ? x : -x; }
istream &operator>>(istream &is, i128 &v) {
    string s;
    is >> s;
    v = 0;
    for(int i = 0; i < (int)s.size(); i++) {
        if(isdigit(s[i])) { v = v * 10 + s[i] - '0'; }
    }
    if(s[0] == '-') { v *= -1; }
    return is;
}

ostream &operator<<(ostream &os, const i128 &v) {
    if(v == 0) { return (os << "0"); }
    i128 num = v;
    if(v < 0) {
        os << '-';
        num = -num;
    }
    string s;
    for(; num > 0; num /= 10) { s.push_back((char)(num % 10) + '0'); }
    reverse(s.begin(), s.end());
    return (os << s);
}
namespace aux {
template <typename T, unsigned N, unsigned L> struct tp {
    static void output(std::ostream &os, const T &v) {
        os << std::get<N>(v) << (&os == &cerr ? ", " : " ");
        tp<T, N + 1, L>::output(os, v);
    }
};
template <typename T, unsigned N> struct tp<T, N, N> {
    static void output(std::ostream &os, const T &v) { os << std::get<N>(v); }
};
} // namespace aux
template <typename... Ts> std::ostream &operator<<(std::ostream &os, const std::tuple<Ts...> &t) {
    if(&os == &cerr) { os << '('; }
    aux::tp<std::tuple<Ts...>, 0, sizeof...(Ts) - 1>::output(os, t);
    if(&os == &cerr) { os << ')'; }
    return os;
}
template <typename T, typename S, typename U> std::ostream &operator<<(std::ostream &os, const priority_queue<T, S, U> &_pq) {
    auto pq = _pq;
    vector<T> res;
    while(!empty(pq)) res.emplace_back(pq.top()), pq.pop();
    return os << res;
}
template <class T, class S> ostream &operator<<(ostream &os, const pair<T, S> &p) {
    if(&os == &cerr) { return os << "(" << p.first << ", " << p.second << ")"; }
    return os << p.first << " " << p.second;
}
template <class Ch, class Tr, class Container> std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, const Container &x) {
    bool f = true;
    if(&os == &cerr) os << "[";
    for(auto &y : x) {
        if(&os == &cerr)
            os << (f ? "" : ", ") << y;
        else
            os << (f ? "" : " ") << y;
        f = false;
    }
    if(&os == &cerr) os << "]";
    return os;
}

#define dump(...) static_cast<void>(0)
#define dbg(...) static_cast<void>(0)

void OUT() { cout << endl; }
template <class Head, class... Tail> void OUT(const Head &head, const Tail &...tail) {
    cout << head;
    if(sizeof...(tail)) cout << ' ';
    OUT(tail...);
}

template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
template <class T, class S> constexpr pair<T, S> inf<pair<T, S>> = {inf<T>, inf<S>};

template <class T> void OUT2(const T &t, T INF = inf<T>, T res = -1) { OUT(t != INF ? t : res); }
template <class T> void OUT2(vector<T> &v, T INF = inf<T>, T res = -1) {
    fore(e, v) if(e == INF) e = res;
    OUT(v);
    fore(e, v) if(e == res) e = INF;
}

template <class F> struct REC {
    F f;
    REC(F &&f_) : f(forward<F>(f_)) {}
    template <class... Args> auto operator()(Args &&...args) const { return f(*this, forward<Args>(args)...); }
};

template <class S> vector<pair<S, int>> runLength(const vector<S> &v) {
    vector<pair<S, int>> res;
    for(auto &e : v) {
        if(res.empty() or res.back().fi != e)
            res.eb(e, 1);
        else
            res.back().se++;
    }
    return res;
}
vector<pair<char, int>> runLength(const string &v) {
    vector<pair<char, int>> res;
    for(auto &e : v) {
        if(res.empty() or res.back().fi != e)
            res.eb(e, 1);
        else
            res.back().se++;
    }
    return res;
}

struct string_converter {
    char start = 0;
    char type(const char &c) const { return (islower(c) ? 'a' : isupper(c) ? 'A' : isdigit(c) ? '0' : 0); }
    int convert(const char &c) {
        if(!start) start = type(c);
        return c - start;
    }
    int convert(const char &c, const string &chars) { return chars.find(c); }
    template <typename T> auto convert(const T &v) {
        vector<decltype(convert(v[0]))> ret;
        ret.reserve(size(v));
        for(auto &&e : v) ret.emplace_back(convert(e));
        return ret;
    }
    template <typename T> auto convert(const T &v, const string &chars) {
        vector<decltype(convert(v[0], chars))> ret;
        ret.reserve(size(v));
        for(auto &&e : v) ret.emplace_back(convert(e, chars));
        return ret;
    }
    int operator()(const char &v, char s = 0) {
        start = s;
        return convert(v);
    }
    int operator()(const char &v, const string &chars) { return convert(v, chars); }
    template <typename T> auto operator()(const T &v, char s = 0) {
        start = s;
        return convert(v);
    }
    template <typename T> auto operator()(const T &v, const string &chars) { return convert(v, chars); }
} toint;

template <class T, class F> T bin_search(T ok, T ng, const F &f) {
    while(abs(ok - ng) > 1) {
        T mid = ok + ng >> 1;
        (f(mid) ? ok : ng) = mid;
    }
    return ok;
}
template <class T, class F> T bin_search_double(T ok, T ng, const F &f, int iter = 80) {
    while(iter--) {
        T mid = (ok + ng) / 2;
        (f(mid) ? ok : ng) = mid;
    }
    return ok;
}

struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(11);
    }
} setup_io;

#endif

#pragma endregion

int main() {
    TEST {
        LL(n, m);
        VEC4(ll, l, r, h, s, n);

        const double speed = 5.25, wait = 0.89;
        constexpr ll d = 24;

        vl x(n);
        rep(i, n) x[i] = max(0, l[i] - 6);

        auto id = iota(x);
        REV(id);
        rearrange(id, x, h, s);
        vector<double> t(n);
        rep(i, n) t[i] = x[i] / speed;

        OUT(bin_search_double(
            1e18, 0.,
            [&](double x) {
                ll sum = 0;
                i128 ret = 0;
                rep(i, n) {
                    if(t[i] > x) return false;
                    ll can = floor((x - t[i]) / wait);
                    if(can == 0) return false;
                    ll need = ceil(h[i] + s[i], d);

                    dump(x, i, can, need, ret);
                    sum += ceil(need - ret, can);
                    ret = ceil(need - ret, can) * can - (need - ret);
                }
                return sum <= m;
            },
            120));
    }
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
2 1
1 2 1 100
100 500 736 0
3 2
0 1 12 0
1 2 6 6
2 3 3 10

output:

49.94476190476
1.78000000000

result:

ok 2 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

1
1 1
999999999999 1000000000000 1000000 1000000

output:

190476264642.11715698242

result:

ok found '190476264642.11716', expected '190476264642.11713', error '0.00000'

Test #3:

score: 0
Accepted
time: 244ms
memory: 13364kb

input:

1
200000 1
0 1 969249 972086
1 2 984744 984320
2 3 92755 47817
3 4 949336 988466
4 5 900430 587028
5 6 971159 502802
6 7 41633 978208
7 8 461354 662596
8 9 363071 263510
9 10 38887 360926
10 11 332384 508699
11 12 106353 110896
12 13 164201 615535
13 14 934900 317571
14 15 566503 490603
15 16 84381 ...

output:

7435986579.12476253510

result:

ok found '7435986579.12476', expected '7435986579.12476', error '0.00000'

Test #4:

score: 0
Accepted
time: 176ms
memory: 13684kb

input:

1
200000 333978112
0 1 992356 930126
1 2 176090 530440
2 3 737831 296956
3 4 506537 237481
4 5 707964 79385
5 6 924758 542461
6 7 105732 39650
7 8 873923 3276
8 9 32864 264522
9 10 395587 86623
10 11 350514 927988
11 12 525625 954467
12 13 244408 909598
13 14 560147 647280
14 15 242630 237857
15 16 ...

output:

38094.79476190477

result:

ok found '38094.79476', expected '38094.79476', error '0.00000'

Test #5:

score: 0
Accepted
time: 179ms
memory: 13644kb

input:

1
200000 1000000000
0 1 945997 933305
1 2 5390 151804
2 3 128320 798645
3 4 701383 107391
4 5 937129 989695
5 6 200579 678099
6 7 26621 111037
7 8 787156 534916
8 9 690049 664552
9 10 986545 948890
10 11 282743 37920
11 12 92545 205330
12 13 746804 959767
13 14 390635 119950
14 15 553450 693187
15 1...

output:

38094.79476190477

result:

ok found '38094.79476', expected '38094.79476', error '0.00000'

Test #6:

score: 0
Accepted
time: 376ms
memory: 3884kb

input:

100000
2 4
28797259691 276830799765 72278 33755
754885936393 923475252381 706795 936638
2 3
59508928733 771976493961 16966 42499
806442361566 991034882904 129056 718490
2 2
172750253246 241424267848 229419 649440
245407392377 589992423297 875885 889270
2 2
206097530212 864358471341 25515 147383
9818...

output:

143787813626.40762329102
153608080080.79144287109
46744314239.17381286621
187014532666.06906127930
88639503158.75621032715
133221473842.12762451172
111401799635.89620971680
98383664158.48715209961
159317167805.92382812500
80919772532.89334106445
153439584652.55810546875
147072054798.24572753906
1076...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 322ms
memory: 3764kb

input:

100000
2 4
26 41 4 12
49 93 67 31
2 2
16 30 5 6
91 100 15 54
2 2
6 33 36 29
42 81 51 40
2 2
0 10 43 41
12 27 1 1
2 4
43 53 9 4
85 90 30 7
2 4
34 49 4 18
61 80 6 45
2 2
43 69 3 20
79 96 35 6
2 3
8 10 27 3
42 77 54 16
2 4
8 9 13 8
37 62 41 11
2 4
23 27 37 22
38 50 45 2
2 4
27 46 20 6
53 58 27 48
2 3
1...

output:

9.97047619048
17.97047619048
10.41714285714
2.92285714286
15.93761904762
11.36619047619
15.68476190476
8.63714285714
6.79476190476
6.98523809524
10.73238095238
5.65190476190
5.84238095238
3.74714285714
16.06571428571
6.22333333333
9.65190476190
7.87523809524
12.50904761905
3.81285714286
10.604285714...

result:

ok 100000 numbers

Test #8:

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

input:

100000
2 3
63 66 1 0
72 97 331 315
2 2
0 10 482 84
22 90 112 91
2 3
32 50 261 2
67 83 719 181
2 2
12 44 23 10
75 79 413 474
2 2
22 35 421 1
63 97 422 562
2 3
14 24 22 5
37 84 551 305
2 3
9 25 36 1
55 70 374 321
2 2
3 44 373 97
51 85 503 241
2 3
26 50 123 119
79 95 391 332
2 4
26 44 260 632
44 100 38...

output:

21.47142857143
16.39761904762
26.74904761905
30.94285714286
37.55714285714
17.47476190476
19.12333333333
31.71142857143
26.36476190476
24.14809523810
16.51238095238
30.26000000000
16.78190476190
18.23666666667
17.02809523810
21.79000000000
36.60142857143
24.65714285714
17.46476190476
20.90333333333
...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 334ms
memory: 4040kb

input:

100000
2 13
69 72 206 156
75 82 119 80
2 30
3 34 307 101
43 62 426 411
2 15
27 30 253 347
50 76 60 388
2 12
16 20 221 51
29 79 173 582
2 17
25 51 3 272
55 58 456 470
2 27
0 43 298 132
67 69 215 529
2 23
30 59 51 563
79 87 363 521
2 29
2 26 36 18
54 78 105 154
2 22
10 19 169 83
57 92 99 412
2 30
1 46...

output:

14.92285714286
8.82761904762
10.16095238095
7.94095238095
12.00333333333
13.39904761905
15.68476190476
10.03285714286
11.49428571429
10.03285714286
9.20857142857
17.20857142857
14.54190476190
2.67000000000
10.16095238095
5.20857142857
10.16095238095
18.67333333333
11.11333333333
12.20380952381
11.36...

result:

ok 100000 numbers

Test #10:

score: 0
Accepted
time: 335ms
memory: 4044kb

input:

66667
3 4
84478696761 215372440520 125248 152596
250810965454 720537889569 668554 998232
828150985733 917337302216 538616 941606
3 3
236183738534 283314823352 801868 737151
341453082312 520548993644 159535 529378
740187497953 870532432850 715530 437783
3 3
175192417072 176862441971 927154 970167
264...

output:

157743063197.89096069336
140988116231.96762084961
106492659239.28524780273
120940620518.99905395508
163160538816.49380493164
188308664413.44287109375
149201625496.71240234375
153551079361.65002441406
106424318255.95620727539
169313137870.35049438477
144256725638.93240356445
147384002511.72763061523
...

result:

ok 66667 numbers

Test #11:

score: 0
Accepted
time: 299ms
memory: 4056kb

input:

66667
3 4
11 26 62 9
26 33 5 43
77 88 5 18
3 4
1 10 1 3
18 32 16 15
35 46 5 5
3 4
8 45 23 61
50 52 4 0
60 87 6 3
3 2
5 7 1 3
29 49 1 58
54 93 2 20
3 3
7 46 9 23
67 68 1 0
77 79 1 6
3 2
50 57 27 48
61 74 1 2
75 95 27 29
3 4
5 14 19 30
43 45 14 37
50 54 71 21
3 3
42 66 2 43
67 79 24 32
89 99 24 0
3 3
...

output:

14.41380952381
6.41380952381
11.17571428571
10.03285714286
14.41380952381
15.81285714286
10.16095238095
16.69952380952
12.38428571429
15.74714285714
17.08047619048
15.36619047619
15.88190476190
16.31857142857
18.16095238095
15.62571428571
14.79476190476
12.89000000000
16.82761904762
16.31857142857
1...

result:

ok 66667 numbers

Test #12:

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

input:

66667
3 3
33 41 362 78
68 78 17 787
86 88 58 207
3 4
7 11 183 116
15 57 246 198
68 69 84 22
3 3
4 10 471 382
35 43 317 273
46 48 58 838
3 3
1 28 1 370
38 39 482 104
40 93 87 14
3 4
5 26 152 33
49 72 322 55
82 88 133 514
3 2
15 30 467 100
33 59 114 755
64 87 177 805
3 4
6 45 143 312
56 75 4 317
83 98...

output:

32.27952380952
15.36952380952
36.09904761905
19.82619047619
24.26619047619
53.76761904762
26.23666666667
34.05952380952
43.33714285714
38.00047619048
27.39619047619
42.31904761905
25.59952380952
36.02333333333
40.28619047619
30.44714285714
23.20238095238
36.15476190476
26.43714285714
19.13000000000
...

result:

ok 66667 numbers

Test #13:

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

input:

66667
3 14
3 7 499 39
31 38 63 24
44 66 89 328
3 27
8 15 286 589
38 48 148 569
74 86 303 494
3 11
34 37 164 41
43 50 687 180
66 75 187 111
3 17
17 32 230 27
64 72 553 404
87 90 347 451
3 17
32 35 129 234
49 64 64 207
97 100 371 414
3 27
2 6 273 118
10 19 270 109
73 93 281 216
3 10
1 16 32 153
33 44 ...

output:

9.01809523810
14.73238095238
14.09857142857
18.98857142857
20.00333333333
13.65190476190
14.04285714286
14.41380952381
15.93761904762
15.81285714286
17.58952380952
15.50095238095
14.35142857143
13.46142857143
14.79809523810
10.73238095238
15.49428571429
14.41380952381
18.54190476190
13.71761904762
9...

result:

ok 66667 numbers

Test #14:

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

input:

50000
4 4
81268202808 746733454011 344996 95484
773994511323 814460911319 237111 309583
860438349719 870176965078 864306 831386
892125406905 940445502602 963093 804924
4 4
60336094423 120458398708 844351 869499
127382397656 141925074629 36260 235297
845551701072 854656619814 834417 834688
8941488590...

output:

169928670787.98287963867
170314074163.28240966797
139941409433.66192626953
88481920995.36238098145
169876798671.58190917969
122899944577.67524719238
141156765834.31857299805
144853852168.25241088867
69270935905.53428649902
169305084145.11526489258
132470888246.52763366699
170547909792.63000488281
84...

result:

ok 50000 numbers

Test #15:

score: 0
Accepted
time: 287ms
memory: 3916kb

input:

50000
4 3
22 28 23 45
46 60 50 29
64 72 82 12
77 91 20 52
4 2
13 36 53 21
40 51 68 24
64 78 18 2
83 99 48 10
4 3
1 26 2 87
53 58 30 54
67 83 2 10
92 97 1 0
4 2
2 19 1 0
19 33 62 24
52 55 9 79
68 99 80 6
4 2
20 22 27 19
28 30 31 61
50 66 7 15
75 86 33 26
4 2
6 42 36 62
51 55 33 40
64 66 20 24
75 99 1...

output:

16.19380952381
18.22666666667
17.27095238095
16.25952380952
15.81285714286
16.58142857143
19.56333333333
13.27095238095
18.41380952381
13.39904761905
17.14619047619
20.19380952381
18.92285714286
14.35142857143
16.19380952381
13.27095238095
17.27095238095
16.31857142857
13.78000000000
13.33666666667
...

result:

ok 50000 numbers

Test #16:

score: 0
Accepted
time: 306ms
memory: 3912kb

input:

50000
4 2
0 19 550 114
32 40 388 196
66 74 116 129
80 95 136 152
4 2
15 17 24 159
35 45 616 126
48 69 186 514
80 86 11 82
4 3
25 36 71 69
38 49 857 69
56 68 523 284
88 89 185 23
4 3
6 51 140 757
58 64 774 187
70 80 48 133
88 93 29 61
4 2
22 37 134 248
38 48 120 128
52 53 210 782
70 77 203 574
4 3
13...

output:

43.46523809524
43.60000000000
36.97904761905
36.60476190476
55.93190476190
29.67857142857
32.15476190476
39.58666666667
54.27333333333
26.88714285714
64.44095238095
14.98857142857
30.49952380952
27.19904761905
72.77285714286
49.44238095238
35.26476190476
42.83809523810
26.31571428571
44.99571428571
...

result:

ok 50000 numbers

Test #17:

score: 0
Accepted
time: 292ms
memory: 3768kb

input:

50000
4 10
17 21 148 230
33 36 84 243
51 58 749 118
76 99 97 419
4 21
0 8 350 179
9 12 390 83
39 41 787 128
42 59 8 78
4 22
10 27 136 133
43 47 115 383
53 62 179 507
64 81 119 64
4 26
1 2 189 222
70 77 62 84
79 83 194 53
97 100 215 18
4 30
1 16 11 198
17 41 132 144
47 61 47 785
81 88 303 504
4 27
1 ...

output:

18.67333333333
8.95571428571
12.51238095238
18.22333333333
16.06571428571
13.08047619048
17.33666666667
13.35000000000
12.12809523810
14.22333333333
17.65190476190
16.31857142857
10.03285714286
22.29238095238
17.27095238095
15.87523809524
17.46476190476
11.81285714286
17.52714285714
12.63714285714
1...

result:

ok 50000 numbers

Test #18:

score: 0
Accepted
time: 294ms
memory: 3844kb

input:

40000
5 2
127768238053 206960001122 432129 213741
242653402068 428677789066 986378 260952
509793892137 538865712590 51574 107473
633924026464 674365258790 985645 959877
699770930198 744174854417 989088 898533
5 3
15201474644 57983658364 975836 672024
126976889947 363836002637 955131 916955
454762384...

output:

133289770988.34239196777
161817616532.73336791992
167850488559.62527465820
143601024417.29336547852
184122012758.05191040039
122368361691.91000366211
186268435716.21145629883
133713513472.63667297363
170436576933.99572753906
146575810438.98953247070
115899168464.02619934082
150615457916.27526855469
...

result:

ok 40000 numbers

Test #19:

score: 0
Accepted
time: 283ms
memory: 3976kb

input:

40000
5 2
0 3 1 43
3 17 69 17
29 43 42 41
44 51 63 18
53 85 75 15
5 3
4 22 34 16
29 42 22 0
47 58 19 13
60 68 11 35
82 89 23 36
5 3
10 12 6 14
23 25 2 5
48 55 79 16
61 83 6 45
85 88 1 20
5 2
4 31 23 32
32 44 12 7
45 56 2 31
57 62 31 42
77 83 50 6
5 4
7 19 53 13
22 23 16 14
27 66 15 51
68 71 41 57
76...

output:

16.07238095238
16.51571428571
15.93761904762
17.72428571429
15.36952380952
16.38428571429
14.79809523810
20.01000000000
17.27761904762
14.86047619048
14.92285714286
17.27095238095
18.09857142857
14.86380952381
14.22666666667
20.32190476190
17.84238095238
15.05095238095
11.62238095238
18.79809523810
...

result:

ok 40000 numbers

Test #20:

score: 0
Accepted
time: 297ms
memory: 3904kb

input:

40000
5 3
7 24 35 164
28 55 74 311
64 77 591 330
78 95 48 518
97 100 623 164
5 4
6 18 106 365
23 54 5 11
55 60 160 818
64 73 1 327
78 88 377 275
5 2
1 49 603 129
50 61 366 282
74 76 82 231
76 78 599 394
81 90 21 17
5 2
5 6 154 416
14 15 66 24
40 44 105 765
58 68 78 37
80 83 898 17
5 2
12 23 369 223
...

output:

50.26333333333
35.07428571429
65.46238095238
58.98619047619
55.60666666667
35.20904761905
54.85809523810
49.63952380952
47.21571428571
35.97095238095
65.46238095238
45.56047619048
22.49285714286
48.42428571429
57.71190476190
54.14190476190
27.26476190476
34.90047619048
48.87095238095
26.17095238095
...

result:

ok 40000 numbers

Test #21:

score: 0
Accepted
time: 281ms
memory: 3848kb

input:

40000
5 11
4 9 124 521
9 42 710 89
47 71 42 133
74 81 2 1
88 94 14 188
5 17
0 44 389 349
45 46 300 128
63 68 806 88
77 81 256 702
86 97 45 586
5 14
0 1 16 770
3 7 492 230
30 52 332 568
81 93 496 262
94 98 23 126
5 12
5 9 46 91
14 16 105 124
23 41 217 50
46 60 107 248
70 84 79 193
5 23
6 13 662 178
1...

output:

17.39904761905
20.64380952381
19.62571428571
13.97047619048
18.22666666667
19.24142857143
18.16095238095
17.01809523810
16.76523809524
17.46142857143
17.71761904762
17.65857142857
18.35809523810
16.51238095238
18.16095238095
12.31857142857
19.56000000000
17.58952380952
13.28095238095
19.05428571429
...

result:

ok 40000 numbers

Test #22:

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

input:

33334
6 2
186059186525 196044993143 932016 834248
226675536647 310789383887 74834 475243
401972786293 503120299340 23521 285656
615922245235 641294950872 760474 134547
684312472456 742865776917 787280 985037
894166287651 992174865342 242120 959832
6 2
96759018121 106326426165 16263 337234
1541213316...

output:

170317432695.83715820312
146932122211.38381958008
178329753295.34524536133
181767659747.97335815430
169774406730.51525878906
161616671526.75146484375
157327016779.20288085938
147512423652.94000244141
158320428162.98049926758
173799763948.67337036133
179474745674.89382934570
159072303029.83953857422
...

result:

ok 33334 numbers

Test #23:

score: 0
Accepted
time: 277ms
memory: 3948kb

input:

33334
6 3
8 28 32 58
38 56 14 84
66 81 12 5
85 95 44 48
96 98 21 77
99 100 24 45
6 3
14 52 10 58
56 62 13 80
66 70 26 31
74 79 3 4
83 86 5 17
90 96 36 15
6 2
4 9 7 0
11 34 16 27
41 48 11 12
50 56 51 33
69 85 39 4
96 98 60 23
6 4
7 10 73 21
33 36 2 41
42 43 7 86
65 68 5 88
76 86 36 35
86 88 25 13
6 4...

output:

23.05428571429
18.67000000000
20.90000000000
17.01809523810
17.52714285714
18.92619047619
17.46809523810
14.92285714286
19.56000000000
18.67666666667
17.71761904762
20.32190476190
18.86047619048
17.08380952381
21.85571428571
21.91809523810
20.51238095238
17.52714285714
20.77190476190
17.52714285714
...

result:

ok 33334 numbers

Test #24:

score: 0
Accepted
time: 287ms
memory: 3840kb

input:

33334
6 3
15 17 138 91
28 40 24 826
49 57 62 248
57 59 371 15
65 71 340 492
90 97 472 207
6 4
1 11 165 80
26 43 69 192
58 62 34 0
67 76 18 55
78 82 212 276
82 100 55 0
6 2
6 12 525 14
15 17 218 33
17 19 251 429
39 52 113 585
58 77 223 191
89 95 384 57
6 4
7 21 6 194
22 24 41 225
31 40 138 381
44 64 ...

output:

53.58047619048
23.38952380952
69.20952380952
31.58000000000
39.53095238095
43.65238095238
43.27809523810
60.44095238095
85.22952380952
47.16333333333
36.10238095238
68.90428571429
64.26380952381
76.83857142857
52.18476190476
52.56238095238
84.28047619048
103.98523809524
37.99714285714
49.82000000000...

result:

ok 33334 numbers

Test #25:

score: 0
Accepted
time: 273ms
memory: 3764kb

input:

33334
6 29
0 12 417 506
13 42 51 80
44 59 389 276
60 61 496 359
65 76 48 546
79 85 107 30
6 21
9 13 75 682
24 28 184 258
63 65 131 375
71 85 182 29
86 96 148 722
97 99 188 191
6 29
4 13 71 303
14 16 315 646
28 33 395 302
43 49 233 96
57 78 466 172
87 92 144 11
6 28
0 5 17 224
10 12 69 179
34 48 426 ...

output:

14.79476190476
20.00333333333
16.31857142857
17.20857142857
16.70619047619
15.36619047619
21.09380952381
14.60428571429
19.00523809524
18.48952380952
18.35142857143
21.08380952381
24.20047619048
13.08047619048
15.17904761905
17.39904761905
16.70285714286
16.44666666667
15.69142857143
15.55666666667
...

result:

ok 33334 numbers

Test #26:

score: 0
Accepted
time: 281ms
memory: 3824kb

input:

28572
7 2
128823193933 206363147796 916586 800328
238780643965 286506376498 656216 792423
315058416223 359651712246 379853 232969
417170446912 529818744727 985905 823065
530714023436 554515278916 968814 990231
557488057446 661929205751 296540 351951
792090500092 841104123481 896126 955265
7 2
666039...

output:

150874449625.14190673828
180943649975.88000488281
174200514045.18145751953
166167738360.40002441406
151678094491.12429809570
174697092412.72192382812
156358375231.83621215820
169879360096.46096801758
160295914731.60763549805
160530186787.58432006836
174015261243.27526855469
182235890676.29382324219
...

result:

ok 28572 numbers

Test #27:

score: 0
Accepted
time: 276ms
memory: 3824kb

input:

28572
7 2
3 6 1 0
11 13 15 43
33 44 9 88
55 64 21 28
65 66 1 1
72 78 6 29
83 84 17 22
7 4
4 6 39 54
8 14 29 57
31 34 13 6
40 41 5 27
49 51 18 10
59 73 34 49
77 82 48 18
7 4
16 21 36 18
30 36 51 7
38 43 63 33
46 50 3 0
55 61 20 5
71 75 18 55
89 93 23 13
7 3
10 17 11 41
35 37 14 4
39 41 7 0
50 65 18 2...

output:

20.00666666667
15.43523809524
17.58952380952
18.73238095238
21.91142857143
19.49761904762
18.79809523810
15.68809523810
20.32523809524
18.10190476190
12.25619047619
24.46000000000
19.36952380952
18.41714285714
17.90809523810
17.33666666667
21.54047619048
21.21190476190
16.31857142857
21.40571428571
...

result:

ok 28572 numbers

Test #28:

score: 0
Accepted
time: 284ms
memory: 3948kb

input:

28572
7 3
1 2 340 335
25 35 243 618
47 51 418 375
60 65 21 31
66 69 218 5
87 94 227 4
96 98 52 644
7 3
1 7 2 95
23 25 437 530
35 41 136 11
66 68 18 588
69 72 670 175
72 82 323 81
88 99 86 430
7 3
1 4 70 75
7 13 103 877
20 48 23 12
53 58 82 37
61 65 719 189
69 83 238 21
90 95 347 262
7 4
2 9 349 580
...

output:

55.92857142857
59.17000000000
48.93000000000
50.91714285714
102.21857142857
32.21714285714
73.60714285714
51.22238095238
47.53428571429
45.63285714286
55.16666666667
55.41619047619
46.46714285714
49.18952380952
49.82000000000
52.18142857143
45.05476190476
50.08285714286
33.93476190476
93.62047619048...

result:

ok 28572 numbers

Test #29:

score: 0
Accepted
time: 274ms
memory: 3848kb

input:

28572
7 26
0 3 419 371
11 13 379 140
14 19 226 577
21 22 11 74
28 55 42 507
57 75 394 69
90 96 37 87
7 16
1 11 63 788
15 30 288 221
44 46 302 385
53 60 641 29
61 88 145 45
91 96 406 258
98 100 281 239
7 11
6 12 225 228
26 28 177 215
31 36 327 6
37 41 201 369
60 62 201 786
71 78 520 215
81 99 181 36
...

output:

16.89000000000
22.42047619048
23.06095238095
27.06428571429
19.62571428571
17.97047619048
17.46142857143
17.58952380952
21.22190476190
17.08380952381
16.76523809524
18.61095238095
15.87523809524
24.65714285714
14.99190476190
18.47952380952
18.86047619048
22.29238095238
20.65380952381
17.08047619048
...

result:

ok 28572 numbers

Test #30:

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

input:

25000
8 3
118405411660 185470941632 60277 719313
441444317941 457848388705 987963 632259
463845444573 490452887031 794779 859355
615555084344 639548718082 841895 650051
698043469193 718026115289 987066 677414
726247716554 734692970513 373028 503163
829429030148 874778564122 999302 992987
89258122539...

output:

170015494890.21478271484
169268313284.35525512695
181751956647.35336303711
173540940794.96621704102
168989519241.16857910156
179141786277.40527343750
107473434064.11048889160
157722445269.82336425781
178155458102.93145751953
182032162703.50811767578
163312401491.08621215820
163161871145.81668090820
...

result:

ok 25000 numbers

Test #31:

score: 0
Accepted
time: 269ms
memory: 3880kb

input:

25000
8 2
2 4 19 79
6 40 2 1
41 44 44 49
49 57 7 20
60 69 1 7
76 77 31 10
79 89 33 66
93 98 56 1
8 3
5 10 3 34
16 28 9 20
37 45 52 41
47 51 7 28
53 56 6 49
59 64 31 22
67 68 14 24
77 95 19 23
8 4
15 27 33 16
28 33 27 62
39 46 41 57
52 55 95 4
59 66 4 0
66 68 77 2
73 75 3 3
83 94 85 3
8 3
7 9 54 12
2...

output:

25.47142857143
17.08380952381
18.22666666667
20.70285714286
17.46476190476
19.43190476190
18.92285714286
21.78333333333
18.93285714286
14.98857142857
22.61095238095
19.75047619048
17.59285714286
16.38428571429
19.87857142857
18.92619047619
21.22190476190
16.89333333333
21.78666666667
21.59619047619
...

result:

ok 25000 numbers

Test #32:

score: 0
Accepted
time: 279ms
memory: 3752kb

input:

25000
8 2
2 4 576 132
5 12 168 224
12 18 670 10
25 34 924 59
36 42 289 191
43 71 352 42
85 90 379 15
94 96 124 52
8 4
0 7 537 144
11 16 16 206
21 23 141 60
25 32 303 253
40 48 703 98
51 58 859 19
74 93 19 594
96 99 230 405
8 2
2 4 6 11
16 21 215 6
33 36 130 338
41 45 194 190
55 60 8 246
63 65 306 59...

output:

89.94904761905
54.52285714286
47.60666666667
84.92095238095
57.32095238095
37.61619047619
93.05571428571
55.98761904762
44.86095238095
74.49047619048
102.52047619048
71.49857142857
57.46571428571
111.17428571429
74.10285714286
62.47714285714
48.23047619048
55.98761904762
66.74666666667
79.2000000000...

result:

ok 25000 numbers

Test #33:

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

input:

25000
8 26
5 6 63 14
12 13 311 144
23 25 444 324
28 29 202 351
36 43 79 182
60 64 564 238
64 72 17 49
87 88 62 873
8 27
4 12 30 8
16 18 22 13
22 28 470 330
40 47 60 87
50 59 529 196
71 86 98 147
89 97 270 100
97 98 51 711
8 10
5 17 405 213
20 23 170 603
23 33 283 249
42 46 310 635
46 48 77 147
49 51...

output:

18.09857142857
19.50095238095
24.91666666667
21.59285714286
20.64047619048
17.78000000000
13.27095238095
19.49761904762
22.61095238095
19.37619047619
17.08047619048
20.20047619048
16.82761904762
17.59952380952
19.05095238095
15.36952380952
22.99190476190
19.88523809524
19.05428571429
21.08380952381
...

result:

ok 25000 numbers

Test #34:

score: 0
Accepted
time: 268ms
memory: 3796kb

input:

22223
9 3
35696533104 144091283802 449305 178318
161692977121 164578427999 79328 387267
185856318558 271826286636 840233 184614
274833632062 279703208464 664121 273244
294172017180 294908306767 972072 737431
328098324304 356660693080 119540 97737
399422629069 567080031986 472328 784284
621465976754 ...

output:

172444147335.79287719727
156632909002.96145629883
176335425364.50335693359
174278482227.46905517578
180483077670.01907348633
163643598976.54000854492
164012754989.35906982422
171927980453.55526733398
186147693535.80761718750
179588570294.54571533203
179613843537.93811035156
182269466802.55050659180
...

result:

ok 22223 numbers

Test #35:

score: 0
Accepted
time: 270ms
memory: 3948kb

input:

22223
9 4
0 4 1 0
6 10 13 27
15 16 9 47
18 30 45 24
36 44 36 6
49 63 39 13
79 85 41 14
89 95 26 21
95 99 28 55
9 2
0 10 2 2
25 26 3 1
27 30 84 6
44 60 85 15
60 67 9 76
68 70 15 4
70 73 36 63
78 90 92 6
95 97 33 7
9 3
1 8 14 20
12 22 51 2
33 38 34 0
43 44 12 7
48 59 16 62
63 66 13 13
74 80 34 7
82 87...

output:

19.62238095238
27.32047619048
20.45000000000
24.58142857143
18.68000000000
24.58142857143
21.34000000000
22.10190476190
17.78000000000
19.75047619048
18.61428571429
25.72428571429
20.26285714286
19.62571428571
24.39095238095
19.43190476190
23.32047619048
24.01000000000
18.73238095238
18.74571428571
...

result:

ok 22223 numbers

Test #36:

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

input:

22223
9 3
12 20 137 558
25 30 542 358
30 38 375 152
41 42 481 248
47 48 17 371
51 62 62 199
76 82 138 34
86 95 66 127
98 100 371 245
9 4
3 9 428 361
15 20 815 28
24 33 526 101
33 41 570 430
43 52 80 13
59 62 12 895
63 72 185 46
84 88 10 9
91 97 79 101
9 3
3 12 493 103
16 23 193 238
26 35 777 141
36 ...

output:

66.87142857143
52.81523809524
76.27047619048
47.53428571429
70.49714285714
110.21523809524
57.26857142857
107.29904761905
61.65952380952
63.11428571429
50.39476190476
57.00571428571
51.16000000000
55.41952380952
50.92047619048
109.19380952381
72.78619047619
89.36095238095
46.13190476190
52.368571428...

result:

ok 22223 numbers

Test #37:

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

input:

22223
9 23
0 5 99 8
7 35 8 443
37 40 48 917
41 43 279 485
56 58 54 913
65 72 322 18
73 83 63 146
86 92 73 902
93 100 624 89
9 23
2 12 10 60
13 15 94 587
17 19 145 78
23 25 575 127
31 35 222 743
48 59 424 136
61 64 193 431
70 80 45 693
86 99 152 175
9 13
0 2 2 29
8 10 72 848
10 27 482 429
30 35 148 3...

output:

21.66190476190
17.90809523810
26.68333333333
17.40238095238
21.53047619048
31.76380952381
18.92285714286
24.01000000000
17.46809523810
20.25952380952
15.36952380952
18.23000000000
18.73571428571
21.14952380952
23.62904761905
19.36952380952
18.03619047619
22.43714285714
29.41238095238
21.02476190476
...

result:

ok 22223 numbers

Test #38:

score: 0
Accepted
time: 270ms
memory: 4052kb

input:

20000
10 4
44477513941 120485254018 224521 521705
185574877925 188048459403 200413 777378
237817597101 275172316645 958833 29823
279625206638 304352862030 199970 802902
421282206041 487650779885 980953 566530
519778297562 641574477792 148936 408791
642059470335 659334418006 714257 807794
69390192799...

output:

165445933047.03097534180
159947985582.99716186523
159695465191.72763061523
179034337680.85241699219
182868377520.61953735352
138506843536.14715576172
176312521484.99334716797
185139926514.75952148438
161289623068.08001708984
181428748479.01907348633
179717895472.75000000000
178498362928.93716430664
...

result:

ok 20000 numbers

Test #39:

score: 0
Accepted
time: 265ms
memory: 3944kb

input:

20000
10 4
1 3 18 66
10 15 14 67
16 17 11 82
18 27 3 10
29 32 71 13
42 47 15 16
48 56 6 58
56 67 24 4
74 75 13 31
86 87 11 22
10 3
3 13 10 8
21 27 63 9
30 36 14 79
36 44 44 19
48 57 2 4
58 70 1 16
74 76 36 23
78 82 6 15
82 84 42 36
92 99 31 0
10 2
0 3 35 50
8 10 11 59
11 32 28 23
32 40 29 3
45 48 39...

output:

17.01809523810
20.70619047619
28.46666666667
22.80142857143
24.70952380952
19.43190476190
22.42714285714
23.12000000000
24.21047619048
20.00333333333
18.47952380952
19.56333333333
24.58142857143
23.94761904762
26.42380952381
23.37619047619
24.46666666667
22.61095238095
24.70952380952
16.51571428571
...

result:

ok 20000 numbers

Test #40:

score: 0
Accepted
time: 277ms
memory: 3848kb

input:

20000
10 2
2 6 74 129
6 11 33 294
17 24 524 348
26 29 41 813
32 38 72 467
39 49 52 324
60 66 268 638
73 76 81 708
78 84 146 750
86 90 295 58
10 2
0 13 187 371
15 17 411 10
25 32 8 259
35 54 127 732
54 56 176 567
57 61 96 71
63 66 408 499
76 80 270 244
80 84 299 374
86 98 66 118
10 4
4 15 5 22
18 19 ...

output:

126.43571428571
112.38285714286
38.12190476190
64.50666666667
42.95285714286
79.51190476190
78.93380952381
135.01380952381
54.77904761905
40.79190476190
64.13238095238
46.64095238095
66.73333333333
97.13476190476
73.85000000000
63.04523809524
67.87952380952
61.89904761905
67.38047619048
63.488571428...

result:

ok 20000 numbers

Test #41:

score: 0
Accepted
time: 266ms
memory: 3816kb

input:

20000
10 23
0 8 12 18
11 23 190 772
35 36 121 34
37 39 384 117
40 43 302 1
47 58 423 432
76 80 524 164
86 91 470 460
93 95 7 27
96 99 257 585
10 29
2 4 39 81
4 5 440 247
6 20 107 590
27 29 6 17
32 35 29 825
37 39 89 275
42 44 61 88
46 48 270 408
53 69 570 104
85 89 162 210
10 14
5 7 350 315
17 24 18...

output:

22.35809523810
16.82761904762
28.14476190476
20.45666666667
22.30571428571
20.00333333333
25.47809523810
26.24666666667
18.22333333333
23.18571428571
22.92952380952
22.03952380952
20.70619047619
20.38761904762
20.19380952381
18.41714285714
21.97380952381
27.95428571429
17.59952380952
23.20238095238
...

result:

ok 20000 numbers

Test #42:

score: 0
Accepted
time: 267ms
memory: 3912kb

input:

18182
11 3
31178638702 58737436442 541438 936550
67800250425 94778245225 52330 17723
131995941492 226554686911 278027 525453
233338377575 257250197813 800472 971998
321625951898 325889896213 147337 405620
490006281837 516729057615 357927 593866
534867015877 645666868249 313036 843543
763329912333 77...

output:

187667945712.83856201172
179095938379.01907348633
176647514577.78622436523
179399186451.25286865234
150931126421.57241821289
169358957988.97335815430
164825567056.61904907227
176946915960.55432128906
177512629845.48715209961
163077100574.47668457031
179891480350.75192260742
162386169049.65097045898
...

result:

ok 18182 numbers

Test #43:

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

input:

18182
11 4
1 7 2 0
24 25 57 1
26 36 16 7
36 38 24 10
44 45 23 2
47 54 30 31
55 58 52 26
71 74 41 1
75 78 41 7
84 91 3 2
97 98 12 3
11 3
5 10 35 9
16 20 8 1
23 25 47 50
40 43 13 74
44 51 11 33
51 59 24 27
61 65 11 75
67 78 64 7
79 80 4 39
95 97 35 20
98 99 4 92
11 3
3 5 65 1
8 17 21 30
19 23 4 22
25 ...

output:

18.41714285714
23.75380952381
23.50095238095
24.32857142857
19.56000000000
22.74571428571
18.41714285714
19.62238095238
24.77190476190
20.83095238095
20.89333333333
21.02476190476
28.33190476190
23.76380952381
18.86047619048
20.32190476190
20.00333333333
18.92619047619
20.00333333333
24.51904761905
...

result:

ok 18182 numbers

Test #44:

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

input:

18182
11 2
0 4 404 171
6 12 186 231
13 20 374 474
29 31 103 8
33 43 210 354
48 52 294 263
53 60 13 99
64 67 421 73
71 73 56 608
74 87 572 322
90 92 46 6
11 3
10 18 410 114
28 29 215 653
30 36 32 19
39 41 11 2
44 46 150 66
49 51 13 43
57 68 241 473
69 72 77 873
74 80 351 0
90 93 946 20
94 99 142 744
...

output:

113.01000000000
85.29190476190
73.22952380952
55.42285714286
126.62285714286
68.89095238095
110.72095238095
69.08809523810
123.24333333333
57.89904761905
98.57952380952
101.69952380952
121.71952380952
53.00238095238
72.70380952381
49.94809523810
77.53809523810
53.95809523810
83.19333333333
143.14190...

result:

ok 18182 numbers

Test #45:

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

input:

18182
11 12
2 5 341 33
6 7 369 96
8 11 347 23
15 17 73 16
19 21 36 93
29 35 38 595
48 52 319 184
61 62 874 76
66 71 330 121
80 83 267 343
85 90 228 27
11 23
2 4 378 296
6 8 1 30
9 10 306 170
15 16 175 649
17 24 159 33
32 39 88 444
40 45 287 156
46 49 466 41
51 59 301 686
71 77 726 167
82 95 38 9
11 ...

output:

24.92000000000
17.72095238095
20.00666666667
20.19380952381
21.60285714286
19.24476190476
20.70285714286
19.62571428571
20.64047619048
21.02142857143
22.86380952381
29.81333333333
21.21523809524
21.74095238095
19.75047619048
22.67666666667
19.43523809524
20.51904761905
20.70285714286
23.94761904762
...

result:

ok 18182 numbers

Test #46:

score: 0
Accepted
time: 180ms
memory: 3820kb

input:

2000
100 5
1942297624 9876178490 9 13
20933932246 25437691547 6 18
25784233050 30905811670 5 15
47773270351 50991199412 7 5
61751701586 67980242949 12 15
68263746951 69391830153 6 1
82718290335 86031544742 9 10
86574500521 87651881457 3 14
90340839367 90562611396 21 9
94139183084 95878805416 1 0
973...

output:

188736407094.41381835938
186806217903.11337280273
185362754217.46145629883
187270519992.12811279297
189246954939.17572021484
188677622828.69952392578
188301772168.06573486328
188760602045.27096557617
186590763691.36621093750
189611980296.69952392578
189719105562.98715209961
188837963015.36621093750
...

result:

ok 2000 numbers

Test #47:

score: 0
Accepted
time: 172ms
memory: 4064kb

input:

2000
100 18
836339689 1596542939 7 9
19610112549 19699319144 18 0
30413237125 36856670808 11 3
44474689632 50842351780 6 10
50975265385 59477746485 17 1
64280707354 66078442647 10 17
66594920068 66978606394 6 5
69017262095 70628805818 8 15
75050447006 82451558109 7 10
83236899037 92650937905 14 12
9...

output:

190101570115.93762207031
187166967653.84240722656
189928670047.93762207031
187444965350.60430908203
189235935569.46145629883
187470056548.12811279297
185244137148.69952392578
187900608337.84240722656
189832293891.17572021484
190411339354.41381835938
189900405966.22335815430
183682550326.03286743164
...

result:

ok 2000 numbers

Test #48:

score: 0
Accepted
time: 164ms
memory: 3856kb

input:

2000
100 27
13705646666 16121551103 10 6
17371494635 19789090386 2 11
27975869738 28335857931 2 6
30262503042 31530091031 2 19
34866060961 37431530895 21 8
42153752740 44966275872 3 9
58217796487 60141385767 8 9
61276941498 70815574448 19 6
73363394137 76856561901 2 24
92146357767 100707132801 23 3
...

output:

187665345461.84240722656
189838528048.89001464844
187883422380.12811279297
189441480533.65191650391
190148801909.84240722656
188795029154.22335815430
189155159937.65191650391
188906194197.08050537109
188433364620.50906372070
189578141663.74716186523
189826797609.08050537109
187450601838.60430908203
...

result:

ok 2000 numbers

Test #49:

score: 0
Accepted
time: 174ms
memory: 3840kb

input:

2000
100 40
19358274532 20214929118 10 11
21155632323 24512933061 17 0
30134318389 30674524320 2 2
31982459470 35247316163 8 4
36585935078 40363775975 1 0
44887652182 45784308674 1 2
56975558983 65057422266 9 6
91329346365 91483258440 9 5
93743902487 95195054143 5 16
110693603751 114553397177 20 0
1...

output:

188302513924.50906372070
186125020975.36621093750
187163221507.55667114258
189612473069.46145629883
190065802773.27096557617
190412218905.08050537109
188989389358.22335815430
187750391607.93762207031
186186074471.93762207031
186295805484.69952392578
189587365907.36621093750
190319504900.31857299805
...

result:

ok 2000 numbers

Test #50:

score: 0
Accepted
time: 174ms
memory: 3844kb

input:

2000
100 44
6883099119 9466427519 12 8
10885411788 23177371555 3 1
24775235205 34248251417 7 22
34329452075 35607488203 7 11
37761037704 40029847856 3 8
52727003869 61904302732 3 15
70608508372 72377325485 7 7
72606231211 73738895023 13 3
74040025053 82436237679 11 19
82631716150 92418420138 19 0
94...

output:

186167038273.46145629883
187056936403.93762207031
189420477992.12811279297
188575360303.74716186523
190434962724.69952392578
188528932916.89001464844
190203017167.93762207031
187973028988.12811279297
190052708673.08050537109
189549731686.60430908203
188478355533.46145629883
189583406061.46145629883
...

result:

ok 2000 numbers

Test #51:

score: 0
Accepted
time: 173ms
memory: 3884kb

input:

2000
100 55
1803819865 3012893217 7 18
11379171824 18612628996 21 8
18705857964 19693484707 4 21
20019259659 22363889135 8 1
22650177222 25169109650 7 0
25839225001 27477389613 2 0
29449201321 29935537834 2 18
30714218932 35542305670 5 6
51626565556 51885095744 8 17
59549448199 63296188906 5 0
65509...

output:

190265673069.08050537109
188846557991.36621093750
189853142147.74716186523
189356570158.60430908203
190268635489.27096557617
188897038308.31857299805
185853782287.74716186523
188318730802.60430908203
188022805882.22335815430
187826676908.31857299805
189668306473.65191650391
188696542612.31857299805
...

result:

ok 2000 numbers

Test #52:

score: 0
Accepted
time: 138ms
memory: 13668kb

input:

1
200000 245736109
3166345 4729069 505392 27528
6028058 6271030 337405 297221
7419713 12004974 9361 132527
13930856 14949932 556981 421138
16566934 17765525 606830 890832
17867131 26728831 492976 246717
33044743 35802435 523133 111934
39252359 48802514 954840 726425
49223506 51853633 615869 532743
5...

output:

190475898029.27096557617

result:

ok found '190475898029.27097', expected '190475898029.27094', error '0.00000'

Test #53:

score: 0
Accepted
time: 134ms
memory: 13644kb

input:

1
200000 59746853
178482 7344834 691264 108579
7416720 12125705 463481 81452
12725369 14142734 226735 364225
14547829 14596615 947623 983595
18124437 20087374 28956 3678
21607610 22169146 367142 908588
23308136 24382397 140205 113958
25198984 27994499 638110 881269
28260316 29286640 321612 372694
29...

output:

190475558563.55667114258

result:

ok found '190475558563.55667', expected '190475558563.55667', error '0.00000'

Test #54:

score: 0
Accepted
time: 222ms
memory: 13536kb

input:

1
200000 23500700
562290 23092250 119164 947601
24999626 25059898 56806 398434
26596600 27488242 877749 938091
36344495 38011107 961224 955797
40950408 41070541 492657 266436
42597099 44114713 321817 265758
61290259 61669766 111406 986044
62013018 65609405 66762 131948
68473095 68647471 857316 34998...

output:

190475267110.41381835938

result:

ok found '190475267110.41382', expected '190475267110.41382', error '0.00000'

Test #55:

score: 0
Accepted
time: 135ms
memory: 13680kb

input:

1
200000 692287252
8613842 9603129 68280 298111
9748093 11052824 325813 39733
16733823 17300095 714407 583209
17787930 18128689 886930 758999
18852505 20249255 894676 399389
23809972 24787332 574109 549503
30023527 41757130 568981 147565
42572533 46359973 15698 21126
52805330 53152484 314386 630094
...

output:

190475876192.50906372070

result:

ok found '190475876192.50906', expected '190475876192.50906', error '0.00000'

Test #56:

score: 0
Accepted
time: 224ms
memory: 13496kb

input:

1
200000 361073803
7871412 9070719 1094 632220
9321608 16857957 125203 150650
17099418 18141415 192907 586485
18323117 19600030 398359 200669
26376398 30812182 420878 375455
35250000 38077121 988835 413918
40030344 40565966 218427 117215
40727644 42251900 966053 717397
48154371 50963814 338362 86405...

output:

190475941930.41381835938

result:

ok found '190475941930.41382', expected '190475941930.41382', error '0.00000'

Test #57:

score: 0
Accepted
time: 227ms
memory: 13628kb

input:

1
200000 175084547
1452185 1757801 287144 613092
2514237 4595084 836141 574211
7293478 8358044 1865 2407
9279363 10583542 477749 107082
14430149 19484758 495520 835784
21141859 21807026 952060 986730
22860164 23822165 958391 996347
25177076 25194887 433156 896920
26507634 31014101 999857 970605
3120...

output:

190475167530.60430908203

result:

ok found '190475167530.60431', expected '190475167530.60428', error '0.00000'

Test #58:

score: 0
Accepted
time: 213ms
memory: 13548kb

input:

1
200000 548903802
1060801 3919637 341299 825859
4576231 6803178 848887 471772
7325211 10689077 282280 171064
12001327 12349368 841953 695977
14490133 20391898 2337 55427
23720332 28271003 280101 194726
29151569 29432309 15810 782215
30757020 36265975 245647 922543
36645213 37208879 908260 799385
38...

output:

190473978724.12811279297

result:

ok found '190473978724.12811', expected '190473978724.12811', error '0.00000'

Test #59:

score: 0
Accepted
time: 133ms
memory: 13556kb

input:

1
200000 512657649
2683126 4962755 97450 369335
6677640 13149612 132371 65891
15310481 15936053 967372 967748
16513735 18414612 165616 325414
20814350 21610291 377301 215435
23284587 26243287 924920 861752
28516578 30060213 329865 87256
31800501 32945982 965449 882071
35012486 39013553 98956 121679
...

output:

190475495722.79476928711

result:

ok found '190475495722.79477', expected '190475495722.79477', error '0.00000'

Test #60:

score: 0
Accepted
time: 225ms
memory: 13628kb

input:

1
200000 181444201
1873011 4783880 516983 216724
5568400 5706128 87710 20859
7402317 7623578 222765 937235
7947991 8780051 586441 666200
10328569 18273806 38149 56854
19773950 20333971 232599 90109
20373078 22742225 960566 108355
25928918 27389309 942407 743227
33114857 33287399 989053 968765
351706...

output:

190475313385.84240722656

result:

ok found '190475313385.84241', expected '190475313385.84238', error '0.00000'

Test #61:

score: 0
Accepted
time: 217ms
memory: 13660kb

input:

1
200000 17390802
4606590 5522939 831971 767251
9594356 17368897 998526 890377
18192082 21191086 828145 887895
22304840 23079238 41887 116071
26030327 34497763 248100 86835
35139982 38239919 766766 93028
47471045 49354607 868067 815134
53204778 59376242 478285 854792
63583224 65591751 297980 198877
...

output:

190475695250.60430908203

result:

ok found '190475695250.60431', expected '190475695250.60428', error '0.00000'

Test #62:

score: 0
Accepted
time: 260ms
memory: 13684kb

input:

1
200000 3
999999800000 999999800001 999998 999997
999999800001 999999800002 999976 999995
999999800002 999999800003 999986 999999
999999800003 999999800004 999992 1000000
999999800004 999999800005 1000000 1000000
999999800005 999999800006 1000000 1000000
999999800006 999999800007 999998 999986
9999...

output:

195420617713.56146240234

result:

ok found '195420617713.56146', expected '195420617713.56143', error '0.00000'

Test #63:

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

input:

1
200000 4
999999800000 999999800001 999995 999983
999999800001 999999800002 999997 999999
999999800002 999999800003 999994 999981
999999800003 999999800004 999998 999992
999999800004 999999800005 999998 999983
999999800005 999999800006 999979 999997
999999800006 999999800007 999999 999971
999999800...

output:

194184506263.91717529297

result:

ok found '194184506263.91718', expected '194184506263.91714', error '0.00000'

Test #64:

score: 0
Accepted
time: 253ms
memory: 13696kb

input:

1
200000 5
999999800000 999999800001 999994 999993
999999800001 999999800002 999999 999996
999999800002 999999800003 1000000 999999
999999800003 999999800004 999986 999990
999999800004 999999800005 999999 999998
999999800005 999999800006 999985 999995
999999800006 999999800007 999985 999990
99999980...

output:

193442839309.45715332031

result:

ok found '193442839309.45715', expected '193442839309.45715', error '0.00000'

Test #65:

score: 0
Accepted
time: 254ms
memory: 13644kb

input:

1
200000 6
999999800000 999999800001 999991 999983
999999800001 999999800002 999998 999999
999999800002 999999800003 1000000 999985
999999800003 999999800004 999999 999998
999999800004 999999800005 999983 999991
999999800005 999999800006 999997 999998
999999800006 999999800007 999995 999997
99999980...

output:

192948394598.70571899414

result:

ok found '192948394598.70572', expected '192948394598.70572', error '0.00000'

Test #66:

score: 0
Accepted
time: 261ms
memory: 13424kb

input:

1
200000 7
999999800000 999999800001 999998 999989
999999800001 999999800002 999996 999996
999999800002 999999800003 999980 999994
999999800003 999999800004 999995 1000000
999999800004 999999800005 999997 999990
999999800005 999999800006 999997 999974
999999800006 999999800007 999998 999972
99999980...

output:

192595219868.72052001953

result:

ok found '192595219868.72052', expected '192595219868.72049', error '0.00000'

Test #67:

score: 0
Accepted
time: 261ms
memory: 13428kb

input:

1
200000 8
999999800000 999999800001 999999 999998
999999800001 999999800002 999995 999999
999999800002 999999800003 999988 999984
999999800003 999999800004 999983 999998
999999800004 999999800005 1000000 999999
999999800005 999999800006 999989 999986
999999800006 999999800007 999996 999988
99999980...

output:

192330338783.87286376953

result:

ok found '192330338783.87286', expected '192330338783.87286', error '0.00000'

Test #68:

score: 0
Accepted
time: 256ms
memory: 13432kb

input:

1
200000 9
999999800000 999999800001 999992 999992
999999800001 999999800002 999998 999999
999999800002 999999800003 1000000 999988
999999800003 999999800004 999974 999997
999999800004 999999800005 999990 999986
999999800005 999999800006 999986 999996
999999800006 999999800007 999988 999982
99999980...

output:

192124320215.50146484375

result:

ok found '192124320215.50146', expected '192124320215.50143', error '0.00000'

Test #69:

score: 0
Accepted
time: 245ms
memory: 13428kb

input:

1
200000 10
999999800000 999999800001 1000000 1000000
999999800001 999999800002 999995 999982
999999800002 999999800003 999994 999990
999999800003 999999800004 999997 999976
999999800004 999999800005 999992 999980
999999800005 999999800006 1000000 999999
999999800006 999999800007 999990 999995
99999...

output:

191959505310.18856811523

result:

ok found '191959505310.18857', expected '191959505310.18857', error '0.00000'