QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#74297#5444. Tavern Chessjapan022022AC ✓948ms66248kbC++2019.8kb2023-01-31 15:00:342023-01-31 15:00:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-31 15:00:35]
  • 评测
  • 测评结果:AC
  • 用时:948ms
  • 内存:66248kb
  • [2023-01-31 15:00:34]
  • 提交

answer

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

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;

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

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

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

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

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

#define stoi stoll

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 2 "library/random/hash_vector.hpp"

#line 2 "library/random/base.hpp"

u64 RNG_64() {
  static uint64_t x_
      = uint64_t(chrono::duration_cast<chrono::nanoseconds>(
                     chrono::high_resolution_clock::now().time_since_epoch())
                     .count())
        * 10150724397891781847ULL;
  x_ ^= x_ << 7;
  return x_ ^= x_ >> 9;
}

u64 RNG(u64 lim) { return RNG_64() % lim; }

ll RNG(ll l, ll r) { return l + RNG_64() % (r - l); }
#line 2 "library/mod/modint61.hpp"
struct modint61 {
  static constexpr bool is_modint = true;
  static constexpr ll mod = (1LL << 61) - 1;
  ll val;
  constexpr modint61(const ll x = 0) : val(x) {
    while (val < 0) val += mod;
    while (val >= mod) val -= mod;
  }
  bool operator<(const modint61 &other) const {
    return val < other.val;
  } // To use std::map
  bool operator==(const modint61 &p) const { return val == p.val; }
  bool operator!=(const modint61 &p) const { return val != p.val; }
  modint61 &operator+=(const modint61 &p) {
    if ((val += p.val) >= mod) val -= mod;
    return *this;
  }
  modint61 &operator-=(const modint61 &p) {
    if ((val += mod - p.val) >= mod) val -= mod;
    return *this;
  }
  modint61 &operator*=(const modint61 &p) {
    ll a = val, b = p.val;
    const ll MASK30 = (1LL << 30) - 1;
    const ll MASK31 = (1LL << 31) - 1;
    const ll MASK61 = (1LL << 61) - 1;
    ll au = a >> 31, ad = a & MASK31;
    ll bu = b >> 31, bd = b & MASK31;
    ll x = ad * bu + au * bd;
    ll xu = x >> 30, xd = x & MASK30;
    x = au * bu * 2 + xu + (xd << 31) + ad * bd;
    xu = x >> 61, xd = x & MASK61;
    x = xu + xd;
    if (x >= MASK61) x -= MASK61;
    val = x;
    return *this;
  }
  modint61 operator-() const { return modint61(get_mod() - val); }
  modint61 &operator/=(const modint61 &p) {
    *this *= p.inverse();
    return *this;
  }
  modint61 operator+(const modint61 &p) const { return modint61(*this) += p; }
  modint61 operator-(const modint61 &p) const { return modint61(*this) -= p; }
  modint61 operator*(const modint61 &p) const { return modint61(*this) *= p; }
  modint61 operator/(const modint61 &p) const { return modint61(*this) /= p; }

  modint61 inverse() const {
    ll a = val, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b), swap(u -= t * v, v);
    }
    return modint61(u);
  }
  modint61 pow(int64_t n) const {
    modint61 ret(1), mul(val);
    while (n > 0) {
      if (n & 1) ret = ret * mul;
      mul = mul * mul;
      n >>= 1;
    }
    return ret;
  }
  static constexpr ll get_mod() { return mod; }
  void write() { fastio::printer.write(val); }
  void read() { fastio::scanner.read(val); }
};
#line 5 "library/random/hash_vector.hpp"

template <typename T>
ll hash_vector(vc<T> X) {
  using mint = modint61;
  static vc<mint> hash_base;
  int n = len(X);
  while (len(hash_base) <= n) { hash_base.eb(RNG(mint::get_mod())); }
  mint H = 0;
  FOR(i, n) H += hash_base[i] * mint(X[i]);
  H += hash_base[n];
  return H.val;
}

template <typename T>
ll hash_pair(pair<T, T> X) {
  static ll hash_base = 0;
  if (hash_base == 0) hash_base = RNG_64();
  return hash_base * X.fi + X.se;
}
#line 3 "library/ds/hashmap.hpp"

// long long -> Val
template <typename Val, int LOG = 20>
struct HashMap {
  int N;
  ll* keys;
  Val* vals;
  vc<int> IDS;
  bitset<1 << LOG> used;
  const int shift;
  const uint64_t r = 11995408973635179863ULL;
  HashMap()
      : N(1 << LOG), keys(new ll[N]), vals(new Val[N]), shift(64 - __lg(N)) {}
  int hash(ll x) {
    static const uint64_t FIXED_RANDOM
        = std::chrono::steady_clock::now().time_since_epoch().count();
    return (uint64_t(x + FIXED_RANDOM) * r) >> shift;
  }

  int index(const ll& key) {
    int i = 0;
    for (i = hash(key); used[i] && keys[i] != key; (i += 1) &= (N - 1)) {}
    return i;
  }

  Val& operator[](const ll& key) {
    int i = index(key);
    if (!used[i]) IDS.eb(i), used[i] = 1, keys[i] = key, vals[i] = Val{};
    return vals[i];
  }

  Val get(const ll& key, Val default_value) {
    int i = index(key);
    if (!used[i]) return default_value;
    return vals[i];
  }

  bool count(const ll& key) {
    int i = index(key);
    return used[i] && keys[i] == key;
  }

  void reset() {
    for (auto&& i: IDS) used[i] = 0;
    IDS.clear();
  }

  vc<pair<ll, Val>> items() {
    vc<pair<ll, Val>> res;
    res.reserve(len(IDS));
    for (auto&& i: IDS) res.eb(keys[i], vals[i]);
    return res;
  }
};
#line 5 "main.cpp"

using Re = long double;

void solve() {
  LL(N, M);
  VEC(int, A, N);
  VEC(int, B, M);
  using T = tuple<Re, Re, Re>;
  HashMap<T> MP;

  auto attacker = [&](vc<int>& X, vc<int>& CX) -> int {
    int mi = 10000;
    int res = -1;
    FOR(i, len(X)) if (X[i] && chmin(mi, CX[i])) res = i;
    return res;
  };

  auto dfs = [&](auto& dfs, vc<int>& X, vc<int>& Y, vc<int> CX, vc<int> CY,
                 int player) -> T {
    vc<int> Z = X;
    Z.insert(Z.end(), all(Y));
    Z.insert(Z.end(), all(CX));
    Z.insert(Z.end(), all(CY));
    Z.eb(player);
    auto key = hash_vector(Z);
    if (MP.count(key)) return MP[key];

    vc<int> I, J;
    FOR(i, N) if (X[i]) I.eb(i);
    FOR(i, M) if (Y[i]) J.eb(i);
    int n = len(I), m = len(J);
    if (n == 0 && m == 0) return {0, 0, 1};
    if (n == 0) return {0, 1, 0};
    if (m == 0) return {1, 0, 0};

    Re a = 0.0, b = 0.0, c = 0.0;

    if (player == 0) {
      int i = attacker(X, CX);
      Re p = 1.0 / m;
      for (auto&& j: J) {
        vc<int> CX1 = CX, CY1 = CY;
        int x = X[i], y = Y[j];
        X[i] = max(0, x - B[j]);
        Y[j] = max(0, y - A[i]);
        CX1[i]++;
        if (X[i] == 0) CX1[i] = 0;
        if (Y[j] == 0) CY1[j] = 0;
        auto [a1, b1, c1] = dfs(dfs, X, Y, CX1, CY1, 1 ^ player);
        a += a1 * p;
        b += b1 * p;
        c += c1 * p;
        X[i] = x, Y[j] = y;
      }
    }
    if (player == 1) {
      int j = attacker(Y, CY);
      Re p = 1.0 / n;
      for (auto&& i: I) {
        vc<int> CX1 = CX, CY1 = CY;
        int x = X[i], y = Y[j];
        X[i] = max(0, x - B[j]);
        Y[j] = max(0, y - A[i]);
        CY1[j]++;
        if (X[i] == 0) CX1[i] = 0;
        if (Y[j] == 0) CY1[j] = 0;
        auto [a1, b1, c1] = dfs(dfs, X, Y, CX1, CY1, 1 ^ player);
        a += a1 * p;
        b += b1 * p;
        c += c1 * p;
        X[i] = x, Y[j] = y;
      }
    }
    MP[key] = {a, b, c};
    return MP[key];
  };

  vc<int> X = A, Y = B;
  vc<int> CX(N, 0), CY(M, 0);
  Re a = 0, b = 0, c = 0;
  if (N >= M) {
    auto [a1, b1, c1] = dfs(dfs, X, Y, CX, CY, 0);
    a += a1, b += b1, c += c1;
  }
  if (N <= M) {
    auto [a1, b1, c1] = dfs(dfs, X, Y, CX, CY, 1);
    a += a1, b += b1, c += c1;
  }
  if (N == M) a /= 2, b /= 2, c /= 2;
  print(a);
  print(b);
  print(c);
}

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

詳細信息

Test #1:

score: 100
Accepted
time: 10ms
memory: 59204kb

input:

2 3
2 5
3 4 1

output:

0.125000000000000
0.750000000000000
0.125000000000000

result:

ok 3 numbers

Test #2:

score: 0
Accepted
time: 11ms
memory: 60992kb

input:

6 6
1 1 4 5 1 4
1 1 4 5 1 4

output:

0.241867283950617
0.241867283950617
0.516265432098765

result:

ok 3 numbers

Test #3:

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

input:

7 7
1 1 1 1 1 1 1
1 1 1 1 1 1 1

output:

0.000000000000000
0.000000000000000
1.000000000000000

result:

ok 3 numbers

Test #4:

score: 0
Accepted
time: 13ms
memory: 59224kb

input:

1 7
7
1 1 1 1 1 1 1

output:

0.000000000000000
0.000000000000000
1.000000000000000

result:

ok 3 numbers

Test #5:

score: 0
Accepted
time: 8ms
memory: 57152kb

input:

2 3
736618938 652769331
328875880 97571721 44608905

output:

1.000000000000000
0.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #6:

score: 0
Accepted
time: 8ms
memory: 59440kb

input:

5 4
53585130 731696211 668322278 611205195 158818781
569587984 776042583 745745433 330119007

output:

0.066840277777778
0.664351851851852
0.268807870370370

result:

ok 3 numbers

Test #7:

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

input:

7 2
578505806 551611151 92903265 403642038 542119417 57334031 307573613
897644535 168524310

output:

1.000000000000000
0.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #8:

score: 0
Accepted
time: 15ms
memory: 61156kb

input:

5 6
113196606 64768263 772808463 787707989 500151952
481840741 676847825 4641268 431386165 847736311 169677832

output:

0.136323173868313
0.522397183641975
0.341279642489712

result:

ok 3 numbers

Test #9:

score: 0
Accepted
time: 51ms
memory: 61272kb

input:

6 6
260666773 527612597 471926610 702232282 559007797 606173983
560573055 928117268 101411867 875949818 907478252 182117037

output:

0.000000000000000
0.960819573045267
0.039180426954733

result:

ok 3 numbers

Test #10:

score: 0
Accepted
time: 8ms
memory: 59080kb

input:

3 3
333377599 3066695 67916629
426841530 865184552 974638244

output:

0.000000000000000
1.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #11:

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

input:

1 1
529429019
529428649

output:

1.000000000000000
0.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #12:

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

input:

3 3
12886596 817437415 465037461
12886473 817437448 465037967

output:

0.069444444444444
0.652777777777778
0.277777777777778

result:

ok 3 numbers

Test #13:

score: 0
Accepted
time: 60ms
memory: 61344kb

input:

6 6
211213374 319527017 257080158 176742665 53109345 33822515
53109265 319527076 176743175 257080012 211212799 33822353

output:

0.423399959276406
0.319386584790809
0.257213455932785

result:

ok 3 numbers

Test #14:

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

input:

1 2
1
1 1

output:

0.000000000000000
1.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #15:

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

input:

1 2
1
1 3

output:

0.000000000000000
1.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #16:

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

input:

1 2
2
4 2

output:

0.000000000000000
1.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #17:

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

input:

1 2
3
5 5

output:

0.000000000000000
1.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #18:

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

input:

1 2
4
1 2

output:

1.000000000000000
0.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #19:

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

input:

1 2
5
2 5

output:

0.000000000000000
0.000000000000000
1.000000000000000

result:

ok 3 numbers

Test #20:

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

input:

1 2
5
5 5

output:

0.000000000000000
1.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #21:

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

input:

2 2
1 1
1 3

output:

0.000000000000000
1.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #22:

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

input:

2 2
1 1
2 3

output:

0.000000000000000
1.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #23:

score: 0
Accepted
time: 8ms
memory: 59224kb

input:

2 2
1 4
2 5

output:

0.000000000000000
0.500000000000000
0.500000000000000

result:

ok 3 numbers

Test #24:

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

input:

2 2
2 2
1 4

output:

0.000000000000000
0.000000000000000
1.000000000000000

result:

ok 3 numbers

Test #25:

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

input:

2 2
3 2
4 1

output:

0.000000000000000
0.500000000000000
0.500000000000000

result:

ok 3 numbers

Test #26:

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

input:

2 2
3 3
1 3

output:

1.000000000000000
0.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #27:

score: 0
Accepted
time: 12ms
memory: 59044kb

input:

2 2
3 3
2 4

output:

0.000000000000000
0.000000000000000
1.000000000000000

result:

ok 3 numbers

Test #28:

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

input:

2 2
3 3
5 3

output:

0.000000000000000
1.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #29:

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

input:

2 2
4 3
2 1

output:

1.000000000000000
0.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #30:

score: 0
Accepted
time: 12ms
memory: 57000kb

input:

2 2
4 3
4 4

output:

0.000000000000000
1.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #31:

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

input:

2 2
5 1
5 2

output:

0.125000000000000
0.625000000000000
0.250000000000000

result:

ok 3 numbers

Test #32:

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

input:

2 2
5 1
5 3

output:

0.125000000000000
0.625000000000000
0.250000000000000

result:

ok 3 numbers

Test #33:

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

input:

2 2
5 2
2 3

output:

0.875000000000000
0.000000000000000
0.125000000000000

result:

ok 3 numbers

Test #34:

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

input:

2 2
5 4
1 2

output:

1.000000000000000
0.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #35:

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

input:

2 2
5 4
3 5

output:

0.875000000000000
0.000000000000000
0.125000000000000

result:

ok 3 numbers

Test #36:

score: 0
Accepted
time: 13ms
memory: 59080kb

input:

2 2
5 5
1 4

output:

1.000000000000000
0.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #37:

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

input:

2 2
5 5
2 2

output:

1.000000000000000
0.000000000000000
0.000000000000000

result:

ok 3 numbers

Test #38:

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

input:

1 1
6
6

output:

0.000000000000000
0.000000000000000
1.000000000000000

result:

ok 3 numbers

Test #39:

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

input:

5 5
6 5 9 9 3
3 5 9 9 6

output:

0.297870370370370
0.278773148148148
0.423356481481481

result:

ok 3 numbers

Test #40:

score: 0
Accepted
time: 40ms
memory: 61208kb

input:

6 6
10 2 3 4 5 7
5 2 4 3 10 7

output:

0.254010456854424
0.192773705418381
0.553215837727195

result:

ok 3 numbers

Test #41:

score: 0
Accepted
time: 137ms
memory: 61372kb

input:

7 7
7 6 8 6 7 3 9
7 6 9 8 7 3 6

output:

0.310913751425669
0.365768367914020
0.323317880660311

result:

ok 3 numbers

Test #42:

score: 0
Accepted
time: 19ms
memory: 61204kb

input:

6 6
5 4 7 9 9 10
9 4 9 7 5 10

output:

0.216942435056584
0.327856545781893
0.455201019161523

result:

ok 3 numbers

Test #43:

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

input:

4 4
9 7 10 6
9 7 6 10

output:

0.330873842592593
0.262297453703704
0.406828703703704

result:

ok 3 numbers

Test #44:

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

input:

3 3
3 10 3
3 10 3

output:

0.187500000000000
0.187500000000000
0.625000000000000

result:

ok 3 numbers

Test #45:

score: 0
Accepted
time: 8ms
memory: 59048kb

input:

2 2
3 4
3 4

output:

0.000000000000000
0.000000000000000
1.000000000000000

result:

ok 3 numbers

Test #46:

score: 0
Accepted
time: 293ms
memory: 61660kb

input:

7 7
922750124 99645786 685060385 948410807 266950246 996521461 883971852
266950246 99645786 883971852 685060385 922750124 996521461 948410807

output:

0.363356371416236
0.279566405511857
0.357077223071906

result:

ok 3 numbers

Test #47:

score: 0
Accepted
time: 521ms
memory: 62664kb

input:

7 7
241155912 361580213 393947982 781406405 485516551 277202028 115028196
485516551 361580213 115028196 393947982 241155912 277202028 781406405

output:

0.370176093599872
0.278789945303564
0.351033961096564

result:

ok 3 numbers

Test #48:

score: 0
Accepted
time: 196ms
memory: 61640kb

input:

7 7
565748008 734938287 873800405 879803305 473331973 893190834 623040014
473331973 734938287 623040014 873800405 565748008 893190834 879803305

output:

0.364305908016637
0.315603554227118
0.320090537756246

result:

ok 3 numbers

Test #49:

score: 0
Accepted
time: 407ms
memory: 62556kb

input:

7 7
14 4 6 5 201506030 15 15
4 14 201506030 15 15 6 5

output:

0.178183791652378
0.337081509869894
0.484734698477728

result:

ok 3 numbers

Test #50:

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

input:

7 7
3 2 3 5 784861968 2 1
2 3 784861968 1 2 3 5

output:

0.223075021873287
0.316151580233162
0.460773397893551

result:

ok 3 numbers

Test #51:

score: 0
Accepted
time: 948ms
memory: 65532kb

input:

7 7
8 15 3 9 168061718 2 5
15 8 168061718 5 2 3 9

output:

0.212969595988052
0.319962995067214
0.467067408944734

result:

ok 3 numbers

Test #52:

score: 0
Accepted
time: 240ms
memory: 61560kb

input:

7 7
859736717 19 19 18 13 10 7
7 10 13 18 19 19 859736717

output:

0.393620652595214
0.147967266251601
0.458412081153185

result:

ok 3 numbers

Test #53:

score: 0
Accepted
time: 394ms
memory: 62704kb

input:

7 7
761045932 18 13 11 9 7 6
6 7 9 11 13 18 761045932

output:

0.382467689555167
0.147493238654727
0.470039071790106

result:

ok 3 numbers

Test #54:

score: 0
Accepted
time: 434ms
memory: 62552kb

input:

7 7
379524878 17 16 14 10 6 1
1 6 10 14 16 17 379524878

output:

0.379260293299904
0.176536722079843
0.444202984620253

result:

ok 3 numbers

Test #55:

score: 0
Accepted
time: 302ms
memory: 61512kb

input:

7 7
986258805 329018732 16 14 10 10 4
4 10 10 14 16 329018732 986258805

output:

0.335206523508067
0.168228186481801
0.496565290010132

result:

ok 3 numbers

Test #56:

score: 0
Accepted
time: 300ms
memory: 61512kb

input:

7 7
402437510 39859989 20 20 18 17 7
7 17 18 20 20 39859989 402437510

output:

0.328699473643151
0.160263058268706
0.511037468088142

result:

ok 3 numbers

Test #57:

score: 0
Accepted
time: 494ms
memory: 62724kb

input:

7 7
719895666 88341845 15 11 10 6 5
5 6 10 11 15 88341845 719895666

output:

0.341541058762872
0.169436596665697
0.489022344571430

result:

ok 3 numbers

Test #58:

score: 0
Accepted
time: 887ms
memory: 66248kb

input:

7 7
22 657372492 8 20 531193761 10 21
8 22 20 657372492 531193761 21 10

output:

0.283032035858509
0.214331641402718
0.502636322738773

result:

ok 3 numbers

Test #59:

score: 0
Accepted
time: 858ms
memory: 66176kb

input:

7 7
8 559730577 2 23 543514141 3 24
2 8 23 559730577 543514141 24 3

output:

0.283681616583426
0.222015713449778
0.494302669966796

result:

ok 3 numbers

Test #60:

score: 0
Accepted
time: 598ms
memory: 62624kb

input:

7 7
24 416408320 4 25 698151361 24 15
4 24 25 416408320 698151361 15 24

output:

0.297516368442785
0.247286586967483
0.455197044589732

result:

ok 3 numbers