QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#104817#6381. LaLa and HarvestingmaspyAC ✓16ms3920kbC++2024.8kb2023-05-12 00:52:562023-05-12 00:53:06

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-12 00:53:06]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:3920kb
  • [2023-05-12 00:52:56]
  • 提交

answer

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

#include <bits/stdc++.h>

using namespace std;

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

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

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

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

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

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

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

#define stoi stoll

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  bool is_prepared() { return prepared; }
  constexpr bool is_directed() { return directed; }

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

  void resize(int n) { N = n; }

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

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

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

  void read_parent(int off = 1) {
    for (int v = 1; v < N; ++v) {
      INT(p);
      p -= off;
      add(p, v);
    }
    build();
  }

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

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

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

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

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

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

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

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

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

  void calc_deg_inout() {
    assert(vc_indeg.empty());
    vc_indeg.resize(N);
    vc_outdeg.resize(N);
    for (auto&& e: edges) { vc_indeg[e.to]++, vc_outdeg[e.frm]++; }
  }
};
#line 4 "main.cpp"

using BS = bitset<500>;

void solve() {
  LL(N, M);

  VEC(ll, A, N);
  Graph<bool, 0> G0(N);
  G0.read_graph(M, 0, 0);

  vc<bool> vis(N);
  vc<bool> used(M);
  vc<int> BACK(N, -1);

  Graph<bool, 1> G(N); // main tree
  vc<int> euler_V;
  vc<int> euler_leaf;

  {
    auto dfs = [&](auto& dfs, int v) -> void {
      euler_V.eb(v);
      vis[v] = 1;
      for (auto&& e: G0[v]) {
        if (used[e.id]) continue;
        if (vis[e.to]) {
          used[e.id] = 1;
          BACK[v] = e.to;
        } else {
          G.add(v, e.to);
          used[e.id] = 1;
          dfs(dfs, e.to);
        }
      }
    };
    dfs(dfs, 0);
  }
  G.build();
  // G.debug();
  auto Gdeg = G.deg_array();
  vc<bool> IS_LEAF(N);
  FOR(v, N) IS_LEAF[v] = Gdeg[v] == 1;
  for (auto&& v: euler_V)
    if (IS_LEAF[v]) euler_leaf.eb(v);

  vv(bool, mat, N, N);
  LL(K);
  FOR(K) {
    LL(a, b);
    mat[a][b] = mat[b][a] = 1;
  }

  vc<int> S;
  FOR(v, N) {
    int deg = SUM<int>(mat[v]);
    // assert(deg <= 1 || deg >= 12);
    if (deg >= 2 || (deg == 1 && K <= 5)) S.eb(v);
  }

  ll ANS = 0;
  vc<int> ANS_state;
  BS ANS_BS;

  auto solve = [&](vc<int> state) -> void {
    struct Data {
      int back;
      bool has_leaf;
      array<int, 16> dp;
      void set(int a, int b, int c, int d, int x) {
        int s = 8 * a + 4 * b + 2 * c + d;
        dp[s] = x;
      }
      int get(int a, int b, int c, int d) {
        int s = 8 * a + 4 * b + 2 * c + d;
        return dp[s];
      }
      void debug() {
        print("back", back);
        print("has_leaf", has_leaf);
        print("dp", dp);
        print();
      }
    };

    auto dfs = [&](auto& dfs, int v) -> Data {
      Data X;
      bool lf = IS_LEAF[v];
      X.has_leaf = lf;
      X.back = BACK[v];
      FOR(s, 16) X.dp[s] = -infty<int>;
      if (state[v] != 0) {
        X.set(1, (BACK[v] == -1 ? 0 : 1), (lf ? 1 : 0), (lf ? 1 : 0), A[v]);
      }
      if (state[v] != 1) { X.set(0, 0, 0, 0, 0); }
      for (auto&& e: G[v]) {
        Data Y = dfs(dfs, e.to);
        Data Z;
        bool back_v = Y.back == v;
        if (Y.back == v) Y.back = -1;
        assert(X.back == -1 || Y.back == -1);
        Z.back = max(X.back, Y.back);
        Z.has_leaf = X.has_leaf || Y.has_leaf;
        FOR(s, 16) Z.dp[s] = -infty<int>;

        FOR(s, 16) {
          FOR(t, 16) {
            if (X.dp[s] == -infty<int>) continue;
            if (Y.dp[t] == -infty<int>) continue;
            bool aX = (s >> 3) & 1;
            bool bX = (s >> 2) & 1;
            bool cX = (s >> 1) & 1;
            bool dX = (s >> 0) & 1;
            bool aY = (t >> 3) & 1;
            bool bY = (t >> 2) & 1;
            bool cY = (t >> 1) & 1;
            bool dY = (t >> 0) & 1;
            if (aX && aY) continue;
            if (back_v && bY && aX) continue;
            if (dX && cY) continue;
            bool a = aX;
            bool b = 0;
            if (Z.back == Y.back) b = bY;
            if (Z.back == X.back) b = bX;
            bool c = (X.has_leaf ? cX : cY);
            bool d = (Y.has_leaf ? dY : dX);
            int u = 0;
            if (a) u |= 8;
            if (b) u |= 4;
            if (c) u |= 2;
            if (d) u |= 1;
            chmax(Z.dp[u], X.dp[s] + Y.dp[t]);
          }
        }
        swap(X, Z);
      }
      /*
      print("v", v);
      X.debug();
      */
      return X;
    };

    Data X = dfs(dfs, 0);
    FOR(s, 16) {
      // bool aX = (s >> 3) & 1;
      // bool bX = (s >> 2) & 1;
      bool cX = (s >> 1) & 1;
      bool dX = (s >> 0) & 1;
      if (cX && dX) continue;
      if (chmax(ANS, X.dp[s])) ANS_state = state;
    }
  };

  int n = len(S);
  FOR(s, 1 << n) {
    vc<int> state(N, -1);
    vc<int> V;
    FOR(i, n) {
      int v = S[i];
      if (s >> i & 1) {
        state[v] = 1;
        V.eb(v);
      } else {
        state[v] = 0;
      }
    }
    bool ok = 1;
    for (auto&& a: V) {
      for (auto&& b: V) {
        if (a == b) continue;
        if (mat[a][b]) ok = 0;
      }
    }
    if (!ok) continue;
    for (auto&& a: V) {
      FOR(v, N) {
        if (mat[a][v]) state[v] = 0;
      }
    }
    solve(state);
  }

  auto solve_restore = [&](vc<int> state) -> void {
    using BS = bitset<500>;
    struct Data {
      int back;
      bool has_leaf;
      array<int, 16> dp;
      array<BS, 16> dp_bs;

      int to_idx(bool a, bool b, bool c, bool d) {
        return 8 * a + 4 * b + 2 * c + d;
      }
      void set(int a, int b, int c, int d, int x) {
        int s = 8 * a + 4 * b + 2 * c + d;
        dp[s] = x;
      }
      int get(int a, int b, int c, int d) {
        int s = 8 * a + 4 * b + 2 * c + d;
        return dp[s];
      }
      void debug() {
        print("back", back);
        print("has_leaf", has_leaf);
        print("dp", dp);
        print();
      }
    };

    auto dfs = [&](auto& dfs, int v) -> Data {
      Data X;
      bool lf = IS_LEAF[v];
      X.has_leaf = lf;
      X.back = BACK[v];
      FOR(s, 16) X.dp[s] = -infty<int>;
      if (state[v] != 0) {
        int s
            = X.to_idx(1, (BACK[v] == -1 ? 0 : 1), (lf ? 1 : 0), (lf ? 1 : 0));
        X.set(1, (BACK[v] == -1 ? 0 : 1), (lf ? 1 : 0), (lf ? 1 : 0), A[v]);
        X.dp_bs[s][v] = 1;
      }
      if (state[v] != 1) { X.set(0, 0, 0, 0, 0); }
      for (auto&& e: G[v]) {
        Data Y = dfs(dfs, e.to);
        Data Z;
        bool back_v = Y.back == v;
        if (Y.back == v) Y.back = -1;
        assert(X.back == -1 || Y.back == -1);
        Z.back = max(X.back, Y.back);
        Z.has_leaf = X.has_leaf || Y.has_leaf;
        FOR(s, 16) Z.dp[s] = -infty<int>;

        FOR(s, 16) {
          FOR(t, 16) {
            if (X.dp[s] == -infty<int>) continue;
            if (Y.dp[t] == -infty<int>) continue;
            bool aX = (s >> 3) & 1;
            bool bX = (s >> 2) & 1;
            bool cX = (s >> 1) & 1;
            bool dX = (s >> 0) & 1;
            bool aY = (t >> 3) & 1;
            bool bY = (t >> 2) & 1;
            bool cY = (t >> 1) & 1;
            bool dY = (t >> 0) & 1;
            if (aX && aY) continue;
            if (back_v && bY && aX) continue;
            if (dX && cY) continue;
            bool a = aX;
            bool b = 0;
            if (Z.back == Y.back) b = bY;
            if (Z.back == X.back) b = bX;
            bool c = (X.has_leaf ? cX : cY);
            bool d = (Y.has_leaf ? dY : dX);
            int u = 0;
            if (a) u |= 8;
            if (b) u |= 4;
            if (c) u |= 2;
            if (d) u |= 1;
            if (chmax(Z.dp[u], X.dp[s] + Y.dp[t])) {
              Z.dp_bs[u] = X.dp_bs[s] | Y.dp_bs[t];
            };
          }
        }
        swap(X, Z);
      }
      return X;
    };
    Data X = dfs(dfs, 0);
    FOR(s, 16) {
      // bool aX = (s >> 3) & 1;
      // bool bX = (s >> 2) & 1;
      bool cX = (s >> 1) & 1;
      bool dX = (s >> 0) & 1;
      if (cX && dX) continue;
      if (ANS == X.dp[s]) { ANS_BS = X.dp_bs[s]; };
    }
  };

  solve_restore(ANS_state);
  vc<int> V;
  FOR(v, N) {
    // if (ANS_state[v] == 0) assert(!ANS_BS[v]);
    // if (ANS_state[v] == 1) assert(ANS_BS[v]);
  }
  FOR(v, N) if (ANS_BS[v]) V.eb(v);
  ll sm = 0;
  for (auto&& v: V) sm += A[v];
  auto adj = mat;
  // for (auto&& e: G0.edges) { adj[e.frm][e.to] = adj[e.to][e.frm] = 1; }
  /*
  FOR(i, len(euler_leaf)) {
    int j = (i + 1 == len(euler_leaf) ? 0 : i + 1);
    int a = euler_leaf[i], b = euler_leaf[j];
    adj[a][b] = adj[b][a] = 1;
  }
  */
  vc<bool> IN_S(N);
  for (auto&& x: S) IN_S[x] = 1;

  /*
  for (auto&& a: V) {
    for (auto&& b: V) {
      if (IN_S[a] && IN_S[b]) assert(!adj[a][b]);
    }
  }
  */

  assert(sm == ANS);
  print(ANS, len(V));
  print(V);
}

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

詳細信息

Test #1:

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

input:

6 7
1 1 1 1 1 1
0 1
1 2
2 3
2 4
1 5
1 4
0 5
1
2 5

output:

2 2
0 4

result:

ok n=6, m=7, k=1, w=2

Test #2:

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

input:

2 1
2 5
0 1
1
0 1

output:

5 1
1

result:

ok n=2, m=1, k=1, w=5

Test #3:

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

input:

3 3
1 1 2
1 2
0 1
0 2
1
1 2

output:

2 1
2

result:

ok n=3, m=3, k=1, w=2

Test #4:

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

input:

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

output:

5 2
1 2

result:

ok n=4, m=4, k=1, w=5

Test #5:

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

input:

5 5
1 2 3 4 4
0 2
1 2
2 4
0 3
0 4
1
3 4

output:

7 2
2 3

result:

ok n=5, m=5, k=1, w=7

Test #6:

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

input:

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

output:

8 2
0 4

result:

ok n=6, m=6, k=1, w=8

Test #7:

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

input:

7 9
4 2 1 1 2 4 4
0 3
0 5
2 3
2 6
4 5
1 3
0 4
0 1
3 6
1
5 6

output:

8 2
0 6

result:

ok n=7, m=9, k=1, w=8

Test #8:

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

input:

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

output:

12 3
2 3 4

result:

ok n=8, m=10, k=1, w=12

Test #9:

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

input:

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

output:

13 3
0 4 6

result:

ok n=9, m=10, k=1, w=13

Test #10:

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

input:

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

output:

19 4
1 3 7 8

result:

ok n=10, m=11, k=1, w=19

Test #11:

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

input:

11 12
5 1 2 5 2 4 3 5 4 1 2
7 9
3 6
4 9
1 4
1 2
2 10
0 7
4 8
2 5
3 7
6 7
0 5
1
2 4

output:

17 5
0 2 3 8 9

result:

ok n=11, m=12, k=1, w=17

Test #12:

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

input:

12 13
1 4 1 3 3 3 5 4 2 4 3 1
1 2
4 7
1 10
0 1
7 9
3 10
5 11
4 5
6 8
5 8
1 8
0 4
1 3
1
3 4

output:

16 5
0 5 6 7 10

result:

ok n=12, m=13, k=1, w=16

Test #13:

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

input:

13 16
2 5 1 5 1 5 5 5 2 5 5 4 1
0 1
0 9
2 7
5 8
4 6
4 12
3 7
3 8
3 10
10 11
9 11
9 12
0 6
5 10
2 3
9 10
1
2 11

output:

21 5
1 4 5 7 9

result:

ok n=13, m=16, k=1, w=21

Test #14:

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

input:

14 17
4 1 1 2 3 4 5 1 3 2 1 4 4 1
5 13
6 12
2 6
0 9
4 12
3 12
9 10
5 9
10 12
7 9
1 12
8 12
10 11
0 7
9 13
8 9
2 12
1
12 13

output:

21 6
0 1 4 5 6 11

result:

ok n=14, m=17, k=1, w=21

Test #15:

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

input:

15 18
5 4 4 5 5 4 4 3 5 5 1 3 5 5 2
6 9
0 7
0 3
2 3
9 10
4 9
1 4
1 14
11 14
12 13
5 13
2 5
2 8
8 14
2 11
10 14
2 13
0 2
1
3 9

output:

31 7
0 1 5 8 9 11 12

result:

ok n=15, m=18, k=1, w=31

Test #16:

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

input:

16 20
3 2 4 2 3 3 4 5 5 2 3 1 5 2 3 3
1 15
9 11
1 7
8 12
2 4
8 13
6 9
0 6
10 12
1 10
3 15
6 10
3 4
5 12
1 14
0 14
2 15
5 10
12 13
6 11
1
1 4

output:

24 7
0 4 5 7 8 9 15

result:

ok n=16, m=20, k=1, w=24

Test #17:

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

input:

17 21
5 2 2 3 3 5 1 5 5 3 5 5 3 1 1 4 4
2 7
3 5
4 15
0 6
4 12
3 11
0 4
8 13
0 1
0 7
11 14
4 9
2 16
5 13
7 11
5 10
0 14
10 11
5 8
7 16
0 9
1
8 10

output:

23 5
0 5 11 15 16

result:

ok n=17, m=21, k=1, w=23

Test #18:

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

input:

18 21
2 5 3 4 1 1 3 3 5 2 2 5 5 1 1 2 1 1
4 13
5 6
6 9
2 7
8 11
0 9
0 16
11 14
12 13
2 12
10 14
10 17
1 16
1 15
3 15
2 3
2 17
8 10
10 16
2 4
0 5
1
1 5

output:

29 9
0 1 3 6 7 8 12 14 17

result:

ok n=18, m=21, k=1, w=29

Test #19:

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

input:

19 23
5 5 1 1 1 3 5 1 1 2 5 1 4 1 5 4 4 5 3
14 15
9 14
3 5
7 18
9 16
4 16
8 9
2 18
5 12
10 12
13 18
4 5
0 14
10 17
4 11
4 18
6 14
1 11
0 6
8 14
2 9
1 4
4 17
1
12 14

output:

29 7
1 5 6 10 15 16 18

result:

ok n=19, m=23, k=1, w=29

Test #20:

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

input:

20 24
3 4 1 5 1 1 5 2 1 4 2 4 2 4 5 2 1 4 1 1
4 19
13 14
14 19
0 15
7 17
16 17
6 10
4 8
2 15
6 19
10 12
3 8
5 14
9 13
5 11
16 19
2 19
1 5
14 18
0 16
12 19
1 19
9 14
3 19
1
5 12

output:

28 8
3 4 6 11 12 14 15 17

result:

ok n=20, m=24, k=1, w=28

Test #21:

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

input:

14 17
4 7 3 3 4 8 7 9 6 1 3 1 1 1
6 13
3 6
2 11
6 12
7 10
9 10
0 12
0 1
9 12
0 4
3 5
8 10
2 12
11 12
8 9
0 9
5 12
13
8 11
5 11
11 13
4 11
11 12
0 11
3 11
2 11
1 11
10 11
6 11
9 11
7 11

output:

31 5
1 2 5 6 8

result:

ok n=14, m=17, k=13, w=31

Test #22:

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

input:

15 17
10 2 5 3 7 6 2 4 9 3 5 7 3 2 4
1 11
2 12
8 14
3 4
0 13
2 14
2 4
2 6
0 5
10 14
7 9
7 8
1 2
5 10
0 11
2 3
9 14
14
4 12
5 12
12 14
2 12
0 12
7 12
3 12
11 12
9 12
10 12
1 12
6 12
8 12
12 13

output:

38 7
0 1 4 6 8 9 10

result:

ok n=15, m=17, k=14, w=38

Test #23:

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

input:

16 19
1 6 7 9 4 9 4 7 2 8 6 2 1 5 1 5
2 15
6 13
3 13
7 13
4 9
1 14
5 10
4 14
0 11
5 15
0 4
3 12
4 15
5 6
8 13
8 15
12 13
0 2
1 4
15
8 15
5 8
3 8
2 8
0 8
8 14
4 8
8 10
8 9
8 11
6 8
8 12
7 8
1 8
8 13

output:

41 8
0 3 6 7 9 10 14 15

result:

ok n=16, m=19, k=15, w=41

Test #24:

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

input:

17 19
10 2 8 2 5 6 2 1 4 8 2 8 10 9 10 7 4
0 1
4 12
5 7
7 13
1 15
8 14
7 9
2 10
11 13
5 12
1 13
2 14
6 16
8 16
0 16
3 13
8 10
0 3
9 13
16
10 11
10 14
4 10
7 10
5 10
10 12
8 10
0 10
9 10
2 10
3 10
10 15
1 10
10 13
6 10
10 16

output:

50 8
0 2 6 7 8 11 12 15

result:

ok n=17, m=19, k=16, w=50

Test #25:

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

input:

18 21
7 5 1 10 6 9 5 5 2 9 3 8 3 4 3 10 6 6
5 11
2 7
0 16
10 17
13 17
0 4
6 12
3 15
2 9
1 10
6 14
0 17
5 15
2 10
10 15
8 17
6 9
0 8
5 10
10 14
1 17
17
1 16
1 5
1 3
1 9
1 11
1 8
1 4
1 7
0 1
1 12
1 10
1 13
1 15
1 2
1 6
1 17
1 14

output:

47 7
7 9 11 14 15 16 17

result:

ok n=18, m=21, k=17, w=47

Test #26:

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

input:

19 22
8 8 2 6 9 10 2 3 5 6 7 6 7 3 1 7 10 10 6
2 5
3 18
4 13
7 18
6 8
5 6
9 13
9 15
12 14
0 12
0 15
0 16
1 17
1 5
0 5
0 11
10 11
10 18
7 11
0 17
5 8
4 9
18
0 13
0 15
0 2
0 5
0 3
0 11
0 12
0 18
0 17
0 7
0 6
0 4
0 8
0 1
0 14
0 16
0 9
0 10

output:

59 8
5 11 12 13 15 16 17 18

result:

ok n=19, m=22, k=18, w=59

Test #27:

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

input:

20 23
7 7 9 8 2 5 5 7 4 3 2 3 2 4 4 3 7 7 1 6
1 3
2 4
4 10
7 12
9 17
10 19
5 13
11 15
5 11
6 16
5 6
0 5
0 12
3 12
3 19
17 18
14 18
8 14
8 19
0 9
2 19
0 16
5 15
19
0 1
1 10
1 15
1 11
1 14
1 5
1 2
1 17
1 12
1 3
1 7
1 4
1 18
1 19
1 16
1 9
1 6
1 13
1 8

output:

56 10
0 2 3 6 7 10 11 13 14 17

result:

ok n=20, m=23, k=19, w=56

Test #28:

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

input:

21 25
1 10 1 10 7 10 6 5 9 9 7 1 1 1 1 2 4 1 2 2 8
0 2
1 4
2 19
3 18
4 17
6 19
5 8
5 7
11 14
7 12
7 19
14 20
17 18
15 18
15 16
16 20
13 19
9 13
9 10
10 20
1 18
3 15
0 15
12 19
7 8
20
5 10
5 20
5 13
5 11
1 5
4 5
5 6
3 5
5 14
5 7
5 17
5 9
5 8
5 12
5 19
2 5
5 18
0 5
5 16
5 15

output:

46 7
0 3 4 8 9 19 20

result:

ok n=21, m=25, k=20, w=46

Test #29:

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

input:

22 25
2 2 3 4 9 8 7 8 3 4 2 8 10 1 3 3 5 10 10 4 7 1
0 16
5 6
7 8
9 13
4 12
4 13
1 4
1 21
5 15
5 16
5 14
2 17
2 14
11 18
11 14
14 21
7 19
7 10
3 10
3 20
3 21
3 19
0 3
4 21
14 17
21
5 9
9 13
2 9
9 16
3 9
8 9
0 9
9 12
1 9
9 11
7 9
9 17
9 15
9 19
9 14
6 9
9 18
9 21
9 10
4 9
9 20

output:

58 9
1 6 7 11 12 13 16 17 20

result:

ok n=22, m=25, k=21, w=58

Test #30:

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

input:

23 25
9 1 1 8 7 1 8 7 5 7 8 2 6 1 1 10 4 7 4 9 4 9 8
0 2
2 3
4 6
11 12
7 12
7 19
1 14
5 16
8 17
5 18
5 15
2 20
2 10
8 10
1 8
1 9
9 13
13 19
6 19
6 15
15 21
15 22
0 22
15 18
12 19
22
4 8
8 9
8 14
8 20
8 18
8 22
7 8
8 11
8 12
1 8
8 17
2 8
8 15
8 19
3 8
8 21
8 13
8 16
8 10
0 8
5 8
6 8

output:

61 9
0 6 7 9 10 11 16 17 21

result:

ok n=23, m=25, k=22, w=61

Test #31:

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

input:

24 31
5 2 9 5 3 8 5 9 1 4 5 3 3 5 7 4 5 3 6 10 5 10 8 2
3 10
19 20
8 22
13 15
4 18
17 20
12 14
3 9
10 16
14 18
6 20
10 22
9 21
1 10
5 10
1 2
10 14
0 22
13 14
10 23
11 22
17 23
7 8
0 11
6 17
10 17
15 22
4 14
2 10
9 10
7 22
23
15 21
9 15
3 15
15 19
15 23
14 15
10 15
2 15
15 16
15 22
12 15
0 15
13 15
6...

output:

59 9
2 3 12 13 17 18 19 21 22

result:

ok n=24, m=31, k=23, w=59

Test #32:

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

input:

25 31
5 5 3 9 4 4 3 3 7 3 10 6 6 5 4 9 4 3 6 2 3 9 6 8 7
5 16
5 18
0 8
5 14
14 19
11 23
7 12
3 13
0 5
2 15
1 13
6 8
1 10
13 22
9 17
8 9
5 7
0 24
5 15
4 8
23 24
3 20
13 24
4 21
0 10
13 20
11 24
0 2
5 19
0 4
8 17
24
8 21
15 21
6 21
12 21
2 21
16 21
0 21
21 24
9 21
14 21
7 21
21 23
21 22
10 21
18 21
5 ...

output:

62 10
3 4 6 9 10 12 14 15 18 23

result:

ok n=25, m=31, k=24, w=62

Test #33:

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

input:

26 34
4 3 1 8 5 7 8 7 10 1 4 7 3 8 9 1 1 6 4 7 1 8 7 3 7 9
7 16
9 13
5 7
2 12
17 20
21 22
6 12
2 7
3 9
4 22
1 7
7 19
2 21
6 8
0 19
19 24
1 15
10 17
3 19
2 14
1 17
8 18
7 11
24 25
16 23
3 13
0 3
19 25
11 19
7 10
4 21
7 21
2 18
7 23
25
11 12
12 19
12 18
12 15
9 12
12 24
3 12
12 25
5 12
12 21
1 12
4 12...

output:

63 9
5 8 11 13 14 16 17 21 24

result:

ok n=26, m=34, k=25, w=63

Test #34:

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

input:

27 31
3 6 9 2 4 7 9 10 6 4 5 4 2 1 9 9 5 10 4 1 3 4 8 2 7 10 9
0 5
0 9
1 6
1 16
2 12
4 14
17 18
10 17
2 19
2 11
4 21
16 22
7 23
7 24
24 25
8 24
8 10
10 15
13 15
11 13
3 11
3 20
16 20
9 16
4 9
4 26
0 26
7 16
10 18
11 19
6 9
26
2 21
7 21
18 21
16 21
14 21
1 21
12 21
8 21
17 21
21 26
13 21
21 23
11 21
...

output:

84 11
1 2 7 8 9 15 17 20 22 25 26

result:

ok n=27, m=31, k=26, w=84

Test #35:

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

input:

28 33
10 1 10 6 4 9 8 4 4 1 2 3 4 3 3 6 5 2 4 1 1 7 6 8 1 1 3 1
7 9
4 8
9 10
9 18
4 12
6 13
0 17
5 18
1 5
14 19
0 21
0 1
22 26
16 23
16 20
4 25
4 6
3 6
3 14
14 26
15 26
1 15
1 2
2 24
11 24
11 20
20 27
20 23
0 20
6 25
13 26
1 22
5 10
27
9 22
10 22
4 22
15 22
22 23
21 22
3 22
8 22
14 22
0 22
1 22
11 2...

output:

65 10
0 2 5 6 7 11 12 14 15 23

result:

ok n=28, m=33, k=27, w=65

Test #36:

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

input:

480 590
52461 193617 43183 44047 2417 66830 101148 194061 145702 67165 25530 172608 39570 3430 5764 159601 54767 12589 129342 11637 51924 36436 11777 183578 95339 38711 145638 98067 38118 27252 158327 133122 83099 175672 69853 40285 121707 56481 50535 183972 70271 163679 107532 45349 17660 180580 12...

output:

25287608 197
4 7 8 9 11 18 23 26 27 29 30 34 36 41 45 47 54 57 58 59 65 66 67 70 74 75 76 77 79 82 83 84 85 86 87 94 96 97 98 99 100 101 110 112 113 116 117 124 127 128 133 134 139 141 142 143 144 145 146 148 151 155 159 161 163 167 169 170 174 175 177 184 186 187 188 190 192 199 201 204 205 210 211...

result:

ok n=480, m=590, k=1, w=25287608

Test #37:

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

input:

481 583
151252 170080 98593 60700 54832 34396 37174 92906 87190 37361 86436 131797 56357 22014 148518 4803 176299 93735 163481 108828 56228 88533 102303 32264 181193 73462 29215 35900 6055 150140 95681 16961 26430 125985 91088 71488 21704 171034 51838 27110 196748 192214 137730 167775 107915 152900 ...

output:

26159531 202
1 9 16 18 19 20 22 24 32 37 40 42 43 45 48 53 57 61 63 64 67 79 80 82 86 88 89 90 92 94 101 102 103 106 110 111 112 113 114 120 121 126 129 135 136 137 138 139 145 146 147 148 149 151 152 157 162 163 166 167 168 170 171 174 176 180 186 187 188 189 190 191 196 197 198 200 203 205 207 208...

result:

ok n=481, m=583, k=1, w=26159531

Test #38:

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

input:

482 584
89431 89854 183448 43148 13362 134801 24250 62494 141258 194287 127216 6761 190757 104203 103542 177508 31954 89204 10511 36697 64886 1086 181519 95103 193750 158316 37715 170385 76997 8466 104443 44332 192106 148066 110856 57225 62204 133601 143355 69974 45113 140276 20596 18459 1070 186538...

output:

25844192 207
0 2 4 9 10 12 19 22 27 30 32 35 38 40 41 43 44 45 46 49 50 51 52 57 59 60 61 64 68 69 70 71 73 75 76 78 79 82 87 90 91 92 100 102 103 105 107 111 114 115 116 120 125 126 133 136 137 138 140 141 144 147 148 151 152 153 154 157 159 160 161 163 164 165 167 168 170 171 172 173 175 177 179 1...

result:

ok n=482, m=584, k=1, w=25844192

Test #39:

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

input:

483 597
30678 16185 14949 171358 40945 42147 7748 160075 187580 44168 194788 185414 46384 108720 114907 49162 336 84395 100075 199787 43603 43597 56859 42171 64353 134363 41659 114917 128346 128798 58824 86070 98205 194890 158548 88909 199897 57955 74148 193071 92092 103261 113958 120181 100402 9885...

output:

26181625 201
2 3 7 8 10 11 13 14 18 19 25 29 30 31 33 34 36 38 39 42 43 49 50 52 55 56 58 60 62 63 64 67 69 70 72 73 74 75 76 80 81 82 84 86 87 90 91 92 93 94 95 96 97 105 109 111 112 113 114 115 117 120 121 132 133 136 138 142 146 153 160 161 164 166 167 168 170 171 172 173 175 176 178 180 183 184 ...

result:

ok n=483, m=597, k=1, w=26181625

Test #40:

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

input:

484 623
97266 77379 4563 64717 92049 83650 136673 103063 102268 139752 69954 18698 31988 89781 109233 56015 35573 102764 86955 62830 45632 32316 54759 94044 85428 161265 28137 82420 23063 13354 126860 125003 60942 161419 128549 68992 4386 49763 76085 161140 102122 72285 129321 74441 16363 114243 860...

output:

24736340 198
3 7 8 10 12 16 20 30 33 34 40 42 43 50 51 52 54 55 56 57 59 61 67 68 74 75 77 78 79 81 85 86 89 90 91 94 96 97 102 107 109 111 112 113 115 116 119 124 126 127 131 132 133 134 136 137 138 140 143 145 148 151 152 153 157 161 164 167 170 171 173 174 176 182 183 188 190 191 192 196 201 211 ...

result:

ok n=484, m=623, k=1, w=24736340

Test #41:

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

input:

485 585
108330 138646 53152 86706 17801 109637 185911 138638 144847 19490 196028 190829 57948 146907 142951 187497 85975 60595 192519 41631 180092 6421 167092 157020 146694 41670 3503 179541 19981 92830 43567 194682 110897 69182 178892 148496 23143 21422 121443 149557 73494 226 160313 138342 115429 ...

output:

25392557 205
0 1 2 5 6 8 10 11 12 13 14 15 18 20 22 27 29 34 35 43 45 47 49 51 52 53 58 60 61 63 65 66 68 69 70 74 78 80 81 82 83 84 86 88 90 91 93 96 97 98 101 103 106 107 108 112 114 115 119 120 121 124 126 127 128 129 131 132 134 135 136 137 145 146 147 148 149 152 154 156 157 158 159 160 164 167...

result:

ok n=485, m=585, k=1, w=25392557

Test #42:

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

input:

486 593
14353 176253 100552 40703 23997 80724 88784 103254 1495 36874 131010 86725 52364 149572 82588 93613 194708 110217 33377 54814 177882 159079 93261 161508 155811 161671 186996 173671 38488 15657 115796 177158 88773 112285 136620 104832 55423 10048 185881 38527 177388 152314 92814 13880 60847 1...

output:

25621745 203
1 2 5 12 14 15 18 20 25 27 31 32 33 34 40 41 42 44 45 46 48 49 50 51 52 53 56 62 63 67 71 72 75 76 79 81 82 83 84 89 92 93 94 95 98 103 105 107 110 112 113 115 117 119 120 123 124 127 130 131 132 135 138 141 142 144 145 148 152 157 160 162 168 169 172 175 181 183 184 185 186 187 189 191...

result:

ok n=486, m=593, k=1, w=25621745

Test #43:

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

input:

487 621
178406 42769 175850 43284 193458 140742 70061 4395 199666 130489 101799 101104 80021 184520 144170 187672 69656 174639 164594 85367 128098 27115 176341 24135 31840 176174 47951 128483 68051 111019 7130 139859 21928 75523 177736 58799 18915 103390 24026 125103 67842 52138 148944 106178 106466...

output:

24230088 194
0 4 6 8 11 12 13 14 15 17 18 22 29 35 36 42 53 57 58 59 64 70 71 76 79 84 86 87 88 90 92 93 95 99 100 101 103 104 105 106 110 112 116 122 126 128 129 132 133 135 137 138 141 145 146 148 154 155 159 160 162 166 167 169 171 174 175 176 177 182 184 187 189 192 198 203 210 214 216 218 221 2...

result:

ok n=487, m=621, k=1, w=24230088

Test #44:

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

input:

488 622
38041 113521 80788 125249 74635 50717 132222 120453 36519 171400 58822 128815 142086 152849 96665 113919 170190 144989 32614 17682 32280 53465 55643 197425 36739 121864 161276 11111 115952 107977 121926 125235 16972 16769 56628 23810 745 77185 112317 181427 112650 134530 175479 47908 112945 ...

output:

25412463 200
2 12 13 17 23 26 28 29 30 31 37 38 39 41 42 45 46 50 52 54 55 56 58 63 64 68 73 74 77 79 81 84 85 87 91 92 94 97 99 100 109 111 112 113 114 117 118 125 129 134 136 137 138 139 141 144 145 146 147 150 153 154 155 157 161 162 174 175 179 182 183 185 192 195 196 202 203 204 205 206 207 209...

result:

ok n=488, m=622, k=1, w=25412463

Test #45:

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

input:

489 629
116448 142664 71794 131622 86089 54390 153477 110652 88269 177044 84517 155737 188205 104230 166257 118989 2690 143213 144823 4288 22972 21554 167651 169450 163483 46526 104788 13565 58438 107852 173831 37332 64744 83534 186679 5947 29231 51260 153601 179635 119964 151939 107304 169305 14616...

output:

25410880 204
1 3 4 5 7 8 9 12 14 17 24 25 26 28 30 33 34 35 36 39 42 43 46 47 52 55 56 57 59 61 62 64 65 68 73 74 75 76 78 81 82 83 84 85 86 87 88 91 92 93 97 99 103 105 106 108 110 111 115 116 120 123 124 125 127 128 132 133 138 140 141 142 143 144 148 151 154 157 161 162 165 169 172 173 178 183 18...

result:

ok n=489, m=629, k=1, w=25410880

Test #46:

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

input:

490 594
12522 5478 57641 195261 166045 59291 11283 156498 94261 89006 162007 22957 65109 82537 45707 86313 83318 151962 177504 57610 24500 141263 12203 161521 124356 91207 113664 96400 61019 1687 3399 122678 29178 36740 175699 26637 64222 178420 39391 76068 174520 31722 30398 139794 141180 57904 177...

output:

25862631 201
2 3 4 10 11 12 13 17 18 23 24 25 26 34 37 40 48 50 51 53 55 56 59 60 61 63 64 66 73 75 79 80 82 85 87 88 91 93 95 99 100 102 103 105 107 108 109 110 112 118 123 126 130 134 136 137 145 146 152 154 155 159 160 161 163 166 167 169 173 175 176 177 178 180 184 186 187 188 193 200 201 206 21...

result:

ok n=490, m=594, k=1, w=25862631

Test #47:

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

input:

491 623
188942 6895 125420 37116 38778 48196 26066 68128 91718 62574 133947 126935 15586 197556 5694 120759 65718 23426 28069 49485 82907 38699 169367 112656 52163 145241 157490 28520 145050 87523 165279 9599 121264 190290 9739 12734 37516 190442 40571 60680 73624 54671 87086 164331 27060 154447 327...

output:

24891404 200
10 13 19 22 23 24 28 29 32 37 40 41 42 43 45 48 49 51 53 55 56 57 61 62 67 72 74 76 80 82 85 88 90 94 95 97 98 100 101 103 104 107 108 110 114 115 116 117 118 120 124 125 126 128 132 134 135 137 142 143 145 148 151 152 155 156 157 158 161 163 164 166 168 171 174 175 176 179 180 181 182 ...

result:

ok n=491, m=623, k=1, w=24891404

Test #48:

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

input:

492 593
75315 115410 153282 43525 53585 61189 49213 193075 114339 38113 42123 1784 79049 27708 64237 106155 130600 128196 184983 91055 119968 31458 21355 14811 79360 46405 34421 39341 133559 173221 142330 66007 193010 30489 99648 197194 19870 59066 154923 14155 139312 45811 120562 122608 157942 6922...

output:

26131189 205
3 5 6 7 8 16 18 22 24 29 30 34 35 38 39 43 44 49 51 55 56 59 61 62 63 65 68 69 73 74 75 78 79 80 83 85 87 91 93 94 95 97 98 99 100 102 105 108 110 113 114 118 119 120 123 131 134 136 138 143 144 146 147 149 150 151 153 157 163 167 169 170 172 176 177 179 180 185 187 188 191 193 194 195 ...

result:

ok n=492, m=593, k=1, w=26131189

Test #49:

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

input:

493 592
55228 55950 141787 62892 54616 196249 152534 195624 9149 64106 60311 8563 120120 191620 77019 182713 108329 182020 172869 115473 101060 100940 138396 68853 165287 17342 48318 171226 10186 181312 116027 19975 118879 176418 89057 164708 118162 50691 64411 131626 188847 118018 138290 34345 1984...

output:

26263776 209
4 5 6 7 9 13 16 17 18 20 21 22 29 30 31 33 35 36 37 38 40 42 47 51 52 55 57 58 61 62 63 64 66 67 68 71 73 76 78 80 84 85 86 88 90 92 94 98 100 104 107 112 113 114 117 122 123 127 128 137 141 142 143 145 147 148 152 154 157 163 164 165 166 168 174 175 188 191 193 194 196 199 200 207 209 ...

result:

ok n=493, m=592, k=1, w=26263776

Test #50:

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

input:

494 585
172069 193775 67030 65284 82080 148385 69583 147751 188208 133693 150177 172470 44868 57935 70324 88115 44195 74408 59396 150999 159561 23226 55354 181496 44659 133104 131889 16142 151077 83605 137619 76592 69822 85687 26086 146556 100639 15965 182539 174966 10251 147108 4587 71691 7213 7110...

output:

26404531 214
0 1 4 5 6 8 9 11 13 15 16 20 21 23 24 26 28 30 31 33 35 36 38 39 41 46 47 52 54 57 59 63 66 71 74 76 80 81 82 84 85 90 91 96 97 100 102 103 104 105 106 107 112 117 118 119 120 125 126 127 128 136 140 141 142 144 145 147 148 150 151 152 158 159 160 161 162 164 167 169 170 171 172 173 176...

result:

ok n=494, m=585, k=1, w=26404531

Test #51:

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

input:

495 634
12023 90056 91294 144456 191802 116546 118626 108915 157701 151384 10483 102279 122719 93373 78025 141797 32364 132684 11652 183717 199115 10016 176814 119209 43513 136397 193339 71513 149237 9349 183882 55668 19172 95546 192841 174619 77293 136401 82936 94846 157340 195349 107300 171065 114...

output:

25990834 202
3 4 6 8 9 11 13 19 20 23 24 26 27 28 33 34 38 40 41 43 46 47 51 53 55 59 60 62 63 64 68 70 72 75 82 84 85 90 93 95 97 99 101 102 104 107 108 109 114 118 120 122 123 126 127 133 136 139 147 148 151 153 155 156 157 160 166 168 172 179 182 183 187 191 195 197 203 206 207 209 210 213 214 21...

result:

ok n=495, m=634, k=1, w=25990834

Test #52:

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

input:

496 631
58225 138398 113658 26324 38007 20034 142193 179789 100488 157926 176149 199133 126018 167446 103680 172324 165503 52597 4978 142339 16874 158713 112596 117961 113387 103894 16807 7538 166800 13474 173995 172343 105609 17173 87003 159877 135844 131324 91413 1658 132169 26155 116261 151203 87...

output:

26868908 203
7 8 9 10 11 13 14 17 19 24 30 31 35 36 37 38 46 47 48 50 52 55 56 57 65 66 67 68 69 79 80 81 84 88 90 91 93 94 97 99 100 104 105 111 113 115 116 120 123 127 129 133 137 139 142 144 145 151 153 154 157 158 159 160 162 164 165 166 168 170 172 174 177 179 181 182 183 185 186 191 192 194 19...

result:

ok n=496, m=631, k=1, w=26868908

Test #53:

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

input:

497 610
5426 61862 59456 87995 121696 12789 171981 181993 92962 103476 183127 48875 92271 177690 11860 182605 67571 34276 967 143167 141501 158938 193745 56283 177507 109579 32898 105825 116414 29016 106641 93378 2791 80811 161113 184936 108190 33820 177168 141092 14471 199803 196403 98030 53439 697...

output:

26395915 202
3 6 8 10 13 15 20 22 23 27 28 35 36 38 40 42 43 44 45 46 47 49 51 52 53 61 64 65 70 71 74 81 82 83 85 86 87 89 91 99 102 107 111 112 113 119 121 124 125 127 131 132 135 148 150 153 155 156 158 160 163 168 171 172 174 175 183 184 186 187 188 190 191 194 195 199 200 204 207 209 216 217 21...

result:

ok n=497, m=610, k=1, w=26395915

Test #54:

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

input:

498 624
165644 191522 150465 150558 181182 43124 164681 137125 133987 72223 117464 62159 173463 28347 73067 45032 71834 75971 147656 124377 69065 100516 18762 43099 25497 29735 173871 103885 167084 63196 101520 168541 8905 178853 170100 108330 7354 122193 199594 39260 195385 111183 45178 180383 1390...

output:

25555285 199
0 1 2 3 6 7 8 10 19 26 28 29 31 34 35 37 44 48 50 53 56 64 65 66 72 74 76 78 87 91 93 94 104 106 110 111 114 116 119 120 122 124 128 135 137 138 139 140 142 143 144 147 148 149 150 157 159 161 166 167 168 171 172 179 180 181 189 191 193 195 197 202 206 208 209 214 220 229 238 240 241 24...

result:

ok n=498, m=624, k=1, w=25555285

Test #55:

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

input:

499 634
123005 48366 16328 64744 34693 58187 165412 162835 192854 152581 24572 78630 141410 123873 56551 89112 195830 64994 132584 114982 102009 6062 66946 96732 175988 6010 140518 35127 129185 199677 187767 135246 64705 60042 34532 116113 22513 163158 107572 157653 96489 80453 151607 40593 52656 41...

output:

25379263 204
3 8 9 12 15 16 17 18 19 24 28 29 30 35 38 39 41 45 50 54 55 56 58 61 63 64 67 68 72 73 76 77 78 79 91 92 95 97 101 106 107 110 116 118 120 122 129 130 136 138 141 143 144 146 147 150 160 165 169 172 173 174 175 176 177 178 180 182 183 184 187 188 189 191 193 196 200 201 203 204 205 206 ...

result:

ok n=499, m=634, k=1, w=25379263

Test #56:

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

input:

500 600
161724 184655 129678 25909 51756 3770 39593 114085 86962 153498 135034 37897 63709 149559 76199 136946 61215 182495 125335 132354 81379 128972 188448 187609 151742 7420 52508 12050 184729 138771 107991 130030 38801 20814 158525 18544 162166 93172 144273 43715 55701 28098 42353 56246 134223 1...

output:

27600356 216
1 3 6 7 9 10 13 16 17 18 19 23 25 26 28 30 31 33 34 36 40 41 42 43 44 45 48 51 52 56 59 63 66 68 71 73 74 77 79 82 83 84 85 86 87 88 90 91 92 94 97 107 108 109 113 114 117 118 120 122 123 125 127 129 130 131 132 136 137 138 139 140 141 142 147 153 155 160 162 163 164 165 168 170 173 179...

result:

ok n=500, m=600, k=1, w=27600356

Test #57:

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

input:

480 611
72240 85652 81217 42225 112472 95105 89604 45661 46454 3248 125910 84502 95119 90645 19645 166574 108081 98789 168746 140162 24661 156685 153495 123055 46054 178498 6727 79261 53693 73925 166475 198179 113993 140073 168470 9138 148020 133745 5178 176177 89456 78146 2883 13942 50890 84620 173...

output:

24169124 194
6 10 11 12 15 18 19 21 25 36 39 41 42 44 46 47 48 49 50 51 53 54 55 59 64 66 72 74 75 78 79 88 90 94 98 100 104 105 106 107 109 111 112 114 115 117 118 121 123 125 127 131 132 133 134 136 138 139 142 145 146 147 152 154 162 164 169 172 174 176 178 179 180 183 185 187 191 192 196 198 201...

result:

ok n=480, m=611, k=100, w=24169124

Test #58:

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

input:

481 594
144571 32291 118185 128901 89922 57101 78567 143538 3092 111123 37127 154927 65114 80409 40140 157973 8387 2502 115371 27062 124302 50512 61883 151543 161225 57282 101527 33583 136348 192676 147608 153126 169150 92523 22109 100562 185138 72716 160712 119198 27972 134140 105379 124853 186990 ...

output:

24533119 201
3 9 11 15 16 17 23 24 25 28 30 31 32 33 36 38 41 44 46 47 49 50 56 58 59 61 62 65 72 74 75 78 81 83 84 88 89 90 91 92 95 97 101 102 107 113 115 116 117 118 119 120 121 124 129 132 133 134 138 141 144 145 146 147 150 151 154 156 157 158 159 160 161 165 166 167 172 175 176 179 185 187 188...

result:

ok n=481, m=594, k=100, w=24533119

Test #59:

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

input:

482 583
109541 34453 168125 78386 122774 83530 52690 78092 124371 129736 103384 152445 74851 64110 66162 158496 120900 84932 59190 166652 138667 83682 70414 144287 139236 170680 103955 150849 115136 182922 44455 120585 141812 16597 2978 69106 172871 57896 141788 25848 153520 134522 68577 172624 1704...

output:

25960586 203
2 3 6 7 8 9 11 12 15 16 17 21 23 25 27 28 29 32 34 38 39 43 46 47 48 52 56 61 63 64 65 66 68 78 79 82 83 84 86 88 90 91 93 94 96 104 105 106 108 112 116 118 120 130 133 137 138 139 142 143 144 145 147 149 150 151 152 155 156 157 158 160 161 164 165 169 173 175 182 183 186 190 193 194 20...

result:

ok n=482, m=583, k=100, w=25960586

Test #60:

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

input:

483 614
5780 17576 4369 8919 192019 120727 107328 90621 165916 138520 60676 120409 76117 139206 184716 32843 169679 110779 37669 64058 172318 92956 100334 81848 112559 85990 156959 35693 73415 45418 84111 49233 130698 194434 158372 3641 126532 27909 28342 47450 98578 11894 62097 153589 6612 185636 9...

output:

24754432 201
4 5 6 7 10 12 15 16 17 22 25 32 33 37 47 48 49 50 53 54 56 57 58 59 62 64 65 66 69 71 72 74 81 85 86 88 92 95 96 99 101 102 104 107 109 110 113 115 119 122 127 128 130 131 136 137 144 145 146 150 151 155 156 158 159 160 166 167 169 171 172 173 175 176 177 180 184 193 199 200 203 204 208...

result:

ok n=483, m=614, k=100, w=24754432

Test #61:

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

input:

484 594
185622 160062 110461 112409 14522 65205 180419 168491 52078 63255 133964 81281 49357 58167 143594 50096 71301 90375 89304 28005 84613 172677 152995 184233 115646 131552 87260 148407 188433 40872 185628 116201 135354 130574 84437 118841 15887 89531 198511 102092 103404 87194 111502 168937 142...

output:

25949100 202
0 1 6 7 10 15 18 20 21 24 28 30 32 38 39 43 49 50 51 54 56 59 60 62 65 69 71 73 74 76 80 82 84 87 88 90 92 95 97 100 101 104 109 112 116 117 119 122 124 131 132 133 135 136 138 139 142 143 145 146 150 152 155 156 157 159 160 161 162 163 164 165 168 171 172 175 178 179 180 181 184 185 18...

result:

ok n=484, m=594, k=100, w=25949100

Test #62:

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

input:

485 591
144778 30921 144022 198975 185531 64614 93339 169162 60896 539 122733 161026 29184 107227 111379 162606 28752 129634 148312 95880 131589 98742 156482 165092 125587 70968 2736 41056 149420 19701 46169 114920 130688 38567 177370 96321 75010 195110 58562 121343 39386 110978 140644 51903 107715 ...

output:

24927731 207
2 3 10 11 13 18 20 23 24 25 27 28 31 34 35 37 38 39 40 46 50 55 61 68 69 71 74 77 79 80 88 91 93 94 98 100 101 102 103 105 106 109 114 116 119 121 122 124 125 128 132 137 139 140 141 144 147 148 151 152 153 155 156 157 158 163 168 169 170 173 174 175 176 178 179 181 182 185 188 189 194 ...

result:

ok n=485, m=591, k=100, w=24927731

Test #63:

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

input:

486 586
158414 13006 39733 68211 87257 69711 80960 111625 187458 103957 122796 18184 140048 145316 157850 88147 82130 146412 163213 87825 52905 39542 41993 69254 2351 38734 197208 135258 63683 39174 46727 97719 87429 170386 168807 7267 134282 133149 155529 147136 13920 9627 134664 179380 16523 1440 ...

output:

26764423 203
0 5 9 14 17 18 19 26 33 34 36 37 38 46 48 50 53 56 57 58 62 68 69 70 72 73 75 76 78 80 81 82 83 85 88 89 90 93 95 99 100 101 102 107 108 111 112 113 115 116 117 118 120 122 125 126 127 128 129 130 133 134 135 136 139 144 146 150 156 157 158 162 163 164 170 172 178 184 188 189 190 195 19...

result:

ok n=486, m=586, k=100, w=26764423

Test #64:

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

input:

487 621
19051 105006 50506 81795 118366 78421 170917 114345 12507 115748 64939 55129 187612 64639 161454 15787 84088 169943 171186 186010 197784 106371 39519 93112 82014 80531 59603 22264 75937 46748 58631 174215 100622 66669 30031 138480 85622 74133 141027 30289 160978 51806 13872 182586 47540 1332...

output:

25413217 208
4 5 6 9 17 18 20 21 22 23 24 30 31 34 36 38 43 45 48 49 58 61 65 66 67 68 69 70 73 78 81 82 84 85 88 89 91 93 94 95 96 98 99 100 101 107 108 109 115 117 118 119 120 121 123 124 127 128 131 133 135 136 139 144 149 152 153 160 161 162 163 165 168 169 173 174 176 177 183 184 186 187 188 18...

result:

ok n=487, m=621, k=100, w=25413217

Test #65:

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

input:

488 622
168083 95521 182687 132347 77181 129235 111343 179433 191256 129029 96199 180267 145092 76693 189095 93516 112493 130789 129863 69502 99790 81334 81231 50147 190055 40050 9656 67276 199684 115322 108536 22897 12007 126940 139176 168111 188809 133728 185973 181754 543 110695 13364 74426 14180...

output:

25573342 196
1 2 5 6 7 8 10 11 12 14 17 18 20 24 27 28 29 30 38 39 43 44 45 47 48 51 54 58 60 63 64 65 66 67 70 71 75 79 81 82 85 87 90 92 93 95 96 97 99 102 105 110 111 112 120 123 132 133 134 135 136 137 141 143 144 150 152 153 154 156 166 168 172 174 176 179 189 192 194 195 197 199 201 204 205 20...

result:

ok n=488, m=622, k=100, w=25573342

Test #66:

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

input:

489 621
8393 132728 109028 113873 137460 113853 19740 99955 199678 164723 97841 9083 74681 119818 40606 23021 182193 120074 42981 140085 123919 150894 103289 142301 108388 124250 164303 164230 128262 170013 38762 174548 164502 110520 137396 120104 10512 6735 56193 82878 157727 64922 144756 51861 184...

output:

25479932 203
2 3 9 10 12 14 16 17 21 22 25 27 28 30 32 39 40 42 44 48 51 52 53 56 57 60 61 64 65 67 70 71 72 75 76 77 79 85 86 87 89 91 93 97 100 105 106 107 109 111 115 124 128 129 132 133 135 137 139 142 143 147 149 150 151 152 155 156 158 160 161 164 165 166 167 169 171 175 176 177 178 184 186 18...

result:

ok n=489, m=621, k=100, w=25479932

Test #67:

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

input:

490 587
148832 116622 62595 56310 63816 46946 187612 97602 36099 46355 112072 185829 120367 106225 109028 88267 166821 94857 121778 188506 43798 33833 45880 105705 44700 23865 243 168767 69107 16845 186307 80290 176652 47749 79186 73734 159002 125382 147856 50887 44674 168962 103175 153388 24251 189...

output:

25007665 205
1 3 6 8 11 14 17 19 20 21 25 26 29 30 32 36 37 38 41 42 46 47 55 58 59 61 62 63 65 66 68 71 75 76 77 78 80 81 83 85 86 88 89 91 93 94 96 100 101 105 108 109 110 111 112 114 117 118 121 124 125 126 127 129 132 133 135 138 140 141 147 149 151 156 158 159 161 162 168 170 172 174 177 180 18...

result:

ok n=490, m=587, k=100, w=25007665

Test #68:

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

input:

491 610
79431 96891 187879 122169 27934 142149 66867 100151 193957 126257 184316 127651 161199 59814 31906 111145 160362 156586 26941 171228 122588 55394 26319 42297 177208 35019 91895 10324 147731 25977 127789 149351 62789 135622 36251 18326 52742 193132 10323 119883 166063 188032 77356 69699 11922...

output:

25817733 207
2 5 8 11 12 16 17 18 19 20 28 31 32 33 34 36 37 39 42 47 53 54 55 56 66 68 70 78 80 82 86 90 91 92 93 94 96 99 102 104 107 109 113 114 118 121 122 123 126 127 129 131 133 134 136 140 143 144 145 150 152 153 154 155 156 158 159 160 163 165 166 167 168 169 170 171 181 184 186 187 191 192 ...

result:

ok n=491, m=610, k=100, w=25817733

Test #69:

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

input:

492 602
139743 113606 75898 30004 195053 138445 177833 3246 194713 186321 126649 8884 145218 36075 193601 148774 29522 164281 31747 40142 94382 64111 9867 25043 33632 184008 35227 176930 13631 84694 160537 81419 88777 60701 56278 145006 178266 23466 121802 107369 182818 21603 107090 9169 195392 5079...

output:

26029985 209
0 4 6 8 9 10 11 14 17 19 20 25 27 28 30 33 34 35 36 38 42 44 46 47 49 51 53 55 64 68 69 71 73 78 79 80 82 83 84 87 92 94 95 101 104 106 108 109 110 116 118 121 122 125 126 127 130 131 132 136 137 140 142 144 148 149 150 153 155 156 158 159 161 167 170 171 174 175 176 177 183 187 190 191...

result:

ok n=492, m=602, k=100, w=26029985

Test #70:

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

input:

493 598
86838 155472 161477 62952 176663 30842 130373 81328 69356 82610 138709 78138 53314 144977 158716 21561 41165 80128 52195 34727 153748 39039 854 133920 43829 158103 12381 180585 76055 60046 9071 42444 31480 86486 192073 99018 32470 169505 90902 22654 93875 27895 166268 167714 141478 102997 12...

output:

26568875 206
1 3 7 9 11 13 17 20 25 27 28 33 34 35 37 41 43 44 45 54 56 57 59 61 67 68 69 71 73 75 78 83 84 88 90 93 94 96 97 99 100 107 109 111 113 117 119 120 122 123 126 127 128 132 135 138 141 144 145 150 151 155 159 165 166 167 168 172 175 179 182 184 186 187 188 190 192 193 195 197 198 199 207...

result:

ok n=493, m=598, k=100, w=26568875

Test #71:

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

input:

494 598
118995 169459 160745 51823 189734 195990 22855 193480 191299 87262 56641 69186 146997 80169 83885 111531 61407 121103 24598 27111 152875 22178 58584 179750 119185 51310 121013 165092 43287 68715 1783 31178 4286 104644 172264 17990 73336 111484 170562 101832 173646 122037 76099 74260 153288 6...

output:

26732300 211
0 1 2 4 7 8 9 12 13 14 17 20 21 23 24 26 27 31 33 34 37 38 39 49 50 51 52 55 56 58 65 68 72 73 75 78 79 81 82 86 88 90 91 92 93 100 103 104 106 107 109 112 113 114 115 117 119 120 124 126 129 130 132 134 137 138 145 147 148 149 150 152 154 155 156 158 159 161 163 169 173 174 181 182 189...

result:

ok n=494, m=598, k=100, w=26732300

Test #72:

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

input:

495 642
33608 44338 148894 84060 127375 62367 21796 20811 46511 193301 17771 103678 171716 10359 91654 96659 158236 25398 186794 191018 54415 71798 11267 39484 110754 107613 120444 3942 196252 81126 37098 140201 100621 111712 164222 109804 75270 52353 34391 80936 60655 199454 167062 103826 135363 14...

output:

23899774 197
4 11 12 14 16 18 19 28 31 33 34 39 41 42 43 45 46 47 49 54 55 61 63 64 68 71 74 75 76 80 85 86 88 89 92 104 106 107 109 111 113 114 117 118 122 127 132 135 137 138 140 141 142 145 148 149 154 155 158 163 165 167 169 172 176 177 178 179 180 181 182 184 185 186 187 191 193 195 198 203 204...

result:

ok n=495, m=642, k=100, w=23899774

Test #73:

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

input:

496 600
7901 81241 81145 2748 125374 179949 117930 80154 107669 156396 54307 36242 21134 16360 92660 59346 15125 81626 121188 19033 65897 148779 51433 143750 183031 162380 112490 3386 124741 170960 158668 3684 120308 184484 118812 62485 195541 145177 144563 159277 25502 159626 194529 170421 58205 30...

output:

25793177 205
1 4 5 6 8 9 12 14 18 21 24 25 26 28 29 32 33 34 36 37 41 42 43 44 49 50 51 52 55 58 59 64 69 70 71 72 73 76 79 83 84 86 89 90 91 95 96 100 101 104 105 107 110 111 116 118 121 124 125 130 131 134 135 137 140 145 147 149 152 154 156 157 160 162 163 164 170 174 175 179 182 184 190 192 197 ...

result:

ok n=496, m=600, k=100, w=25793177

Test #74:

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

input:

497 599
178670 119201 20893 123134 109839 109808 32628 124963 148105 126343 103622 84376 115922 4251 106407 122731 83126 182220 106623 38718 162055 153833 153285 93892 180743 154832 114968 13032 86013 30346 186016 94778 11316 93081 59539 134870 38200 100724 75116 172032 33559 93994 97938 190208 4475...

output:

26280367 209
1 2 3 4 5 9 11 12 15 17 20 30 34 36 38 42 43 44 47 52 54 55 58 64 68 70 74 77 78 79 83 84 87 88 93 94 97 103 104 105 109 112 113 114 117 122 126 127 128 130 131 132 135 136 137 138 139 145 146 147 151 155 158 159 160 164 166 167 168 171 174 175 177 181 182 186 187 188 193 194 195 197 20...

result:

ok n=497, m=599, k=100, w=26280367

Test #75:

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

input:

498 640
132657 162392 46375 10439 139231 162852 112631 194436 30697 94353 21544 120002 153109 26588 87356 171249 58372 171281 18391 31700 12140 16686 107845 39660 120912 92058 85011 117606 14581 48999 114643 84598 141191 166929 150454 101036 7549 152908 15848 124781 156425 150725 107845 86815 43167 ...

output:

25523709 198
1 5 6 7 11 12 13 14 15 17 19 22 29 31 32 34 35 36 40 41 45 48 51 54 55 62 64 66 67 73 76 81 82 83 87 90 91 93 94 95 96 99 100 106 108 113 114 117 118 120 130 131 133 134 136 137 138 139 140 142 145 146 149 153 156 158 159 160 161 163 165 168 171 172 178 179 185 187 190 192 194 196 201 2...

result:

ok n=498, m=640, k=100, w=25523709

Test #76:

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

input:

499 623
145297 161835 60725 19779 93854 102560 157076 158120 36808 131746 102669 159406 76369 134034 163369 115159 70133 29067 32098 110243 153650 149482 88141 176359 22943 28453 29685 193109 71889 115620 176500 153783 155520 112480 117300 173187 127351 197403 155536 197222 171046 84561 22223 159113...

output:

25966857 203
0 1 2 7 9 10 11 13 15 19 23 24 25 27 31 32 33 34 35 37 38 39 44 46 48 51 52 56 57 68 69 73 85 86 87 88 89 90 93 94 95 96 98 102 104 105 114 117 119 126 129 130 137 138 139 140 141 143 146 148 155 156 157 161 162 163 164 167 171 174 175 176 179 181 187 189 193 194 198 200 205 208 210 211...

result:

ok n=499, m=623, k=100, w=25966857

Test #77:

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

input:

500 634
52206 77388 84711 77082 63107 56378 183685 185427 152941 172594 49037 163043 3058 180754 172026 143936 24830 44372 184418 162787 1270 190282 148919 75814 189732 159141 142419 137117 17381 76877 152251 63080 65465 138713 155759 196323 104804 38838 122887 80836 117431 14653 7914 93348 142319 5...

output:

25410340 200
0 1 2 6 7 9 10 13 14 21 23 25 29 34 37 40 43 45 48 49 54 55 58 59 60 61 63 64 67 77 82 83 85 86 90 94 97 100 102 103 104 106 109 110 111 113 114 115 118 121 123 125 131 135 139 142 144 145 147 149 150 151 154 159 161 166 167 171 172 176 177 178 180 183 185 188 191 192 195 196 197 201 20...

result:

ok n=500, m=634, k=100, w=25410340

Test #78:

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

input:

480 593
174545 191742 181354 1969 141210 100262 132870 21880 133295 157382 53391 25434 27829 15393 127818 112232 31199 11433 127337 58992 194593 124862 134023 15588 40429 96436 99057 48462 110950 32202 89020 179783 18403 126345 180757 25153 117438 121410 79615 116003 137871 23014 84970 171075 72883 ...

output:

24510717 203
0 1 2 5 7 9 14 20 21 22 29 34 38 39 42 43 44 50 52 54 55 56 57 58 60 66 74 80 81 82 83 90 94 96 104 108 110 113 114 117 118 119 121 122 123 124 125 127 128 131 134 136 138 140 143 148 150 151 154 156 158 159 160 162 164 165 171 172 176 180 183 186 187 190 191 193 196 197 205 206 209 211...

result:

ok n=480, m=593, k=100, w=24510717

Test #79:

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

input:

481 609
93962 195986 113489 87134 160959 20898 153613 59252 40207 60677 195574 195311 198782 48073 40357 139628 99091 143049 99970 51661 177019 151463 33368 171717 104969 189757 24868 3166 8959 171701 74749 100499 14327 125736 152667 110462 8965 163739 99361 168094 137308 177160 96 196245 169430 151...

output:

23798397 187
1 3 4 6 8 10 11 12 15 17 18 23 25 30 33 34 36 37 41 44 47 49 52 53 56 60 61 65 72 73 74 82 83 85 86 90 92 94 95 96 99 102 104 106 113 114 117 118 119 122 126 127 131 132 133 135 138 139 143 144 145 146 147 150 151 152 158 162 163 172 173 175 176 181 183 186 189 193 200 204 206 209 211 2...

result:

ok n=481, m=609, k=100, w=23798397

Test #80:

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

input:

482 613
87805 122371 32427 43994 130074 128348 117588 3332 154022 27859 183024 194967 55505 145442 96540 87920 17124 57100 178112 112438 39131 138830 145372 43457 91383 134369 169008 191789 57882 121006 19595 79363 92946 153970 35029 8103 32233 52581 23005 97537 111372 89934 137628 72562 199984 1959...

output:

24383201 191
0 4 5 8 10 11 15 18 21 22 26 29 33 40 45 46 48 49 50 52 53 58 60 61 64 69 71 75 79 82 84 86 87 92 94 95 96 97 98 99 104 105 107 109 110 113 115 117 119 122 125 126 127 130 131 134 135 136 140 143 148 153 155 156 157 159 163 165 168 169 170 172 173 174 177 178 181 182 185 187 189 192 196...

result:

ok n=482, m=613, k=100, w=24383201

Test #81:

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

input:

483 580
199919 48120 149883 151035 138580 197400 91643 143449 22817 24506 646 89715 106350 53976 173244 188507 21130 147607 32934 96191 130046 52816 13944 164663 188174 89829 185082 140397 111583 35619 14549 190488 193195 88857 198123 177425 139206 72702 103452 143045 139840 96418 179799 198160 2635...

output:

25684750 203
0 2 3 4 5 12 13 15 19 23 24 27 29 32 33 34 35 36 39 40 42 43 46 49 51 54 55 56 57 60 61 62 65 66 68 70 71 74 75 78 79 80 81 84 85 87 88 91 92 96 99 101 102 104 110 114 117 121 126 127 132 133 134 135 136 142 143 148 153 154 155 161 162 167 169 170 172 173 175 179 180 183 184 188 189 191...

result:

ok n=483, m=580, k=100, w=25684750

Test #82:

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

input:

484 612
44724 188470 109091 66334 190888 40663 23888 170648 115136 9650 156695 197034 57436 53807 114558 89793 102023 167326 101140 16855 65431 31043 98998 14976 76884 37925 124290 10536 104716 81863 87008 56739 56704 6819 88875 181315 170159 9412 150122 164038 103330 159450 155998 55697 10059 19861...

output:

26273561 197
1 11 17 18 24 26 28 29 35 39 40 41 42 49 50 51 56 57 58 61 63 66 68 72 75 77 79 80 82 87 89 90 91 92 94 95 97 99 100 108 110 111 113 115 116 118 126 127 128 130 131 132 139 141 146 148 152 154 158 162 163 164 165 168 170 175 176 177 182 183 185 186 187 188 193 194 199 201 203 206 208 21...

result:

ok n=484, m=612, k=100, w=26273561

Test #83:

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

input:

485 625
36854 18188 40192 127245 21996 116581 97563 169429 43750 175899 30283 71452 73907 27133 162795 36868 120755 129905 69140 191841 143317 125830 194868 119862 142905 158971 148006 168317 74370 128853 42492 81688 46775 106962 27883 132461 132482 173890 96762 35910 150730 135738 71933 58990 15020...

output:

25085042 193
5 7 9 14 16 17 19 20 22 23 24 31 34 37 38 39 40 41 43 45 47 49 50 52 54 55 57 59 61 62 63 66 67 68 69 76 78 80 81 82 83 87 91 93 97 98 99 103 104 105 109 113 116 121 123 126 128 130 139 142 146 147 149 151 153 154 155 157 163 165 166 168 171 172 176 178 181 187 192 197 200 201 202 204 2...

result:

ok n=485, m=625, k=100, w=25085042

Test #84:

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

input:

486 617
21783 199085 111364 104309 129763 6952 153034 86218 22657 131505 94166 15098 102872 161147 94166 25947 21651 50003 96772 37618 70516 169368 170554 176781 105523 191450 104790 86109 76633 165236 113885 67351 24755 85232 74225 2542 32641 62110 8234 23770 110253 17712 37557 71435 164366 184427 ...

output:

23823784 193
1 8 13 14 21 22 23 25 26 33 34 44 45 46 47 49 50 53 56 57 59 60 61 62 68 72 73 75 79 81 83 87 90 95 96 98 99 100 103 104 106 109 112 117 120 122 123 129 131 134 135 136 137 142 143 145 146 147 151 152 154 156 157 160 161 162 164 166 168 169 170 171 172 174 179 180 184 189 192 193 195 19...

result:

ok n=486, m=617, k=100, w=23823784

Test #85:

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

input:

487 579
2319 94358 139989 64938 174495 154000 77152 184843 14961 129807 65692 135452 69915 110739 103529 185023 113462 21230 20065 68907 105364 173039 189827 62843 158150 2478 29797 182238 118651 100522 195185 87572 195122 27759 67766 104108 23118 150291 188391 30463 123751 51560 62186 186176 27685 ...

output:

26143798 203
2 4 5 9 11 12 15 16 17 20 21 22 26 28 30 31 32 37 38 39 40 45 47 48 51 52 53 55 57 59 67 69 71 75 77 78 79 80 83 85 86 88 89 93 99 103 107 108 109 111 113 115 116 117 120 122 124 126 128 131 132 135 137 145 146 147 154 156 157 161 162 163 165 168 173 178 179 180 182 184 185 186 189 190 ...

result:

ok n=487, m=579, k=100, w=26143798

Test #86:

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

input:

488 621
196953 1057 1286 66925 57979 114811 165057 4179 175840 157368 127164 145680 65380 58418 12610 63644 35703 180417 126716 125696 124085 59451 72678 14945 36472 98092 55408 185072 123177 63966 58803 67646 353 30497 189911 143409 97478 67202 164313 161850 20615 189147 198540 171299 183435 47969 ...

output:

25366544 198
0 10 11 15 25 27 29 36 38 39 40 41 42 43 44 48 49 51 52 54 57 58 60 64 65 66 67 68 70 74 75 76 81 82 83 91 93 94 97 102 103 107 109 111 114 118 122 123 124 125 126 131 133 138 139 142 149 150 154 157 163 167 171 173 174 175 178 180 181 183 186 187 189 190 191 195 200 202 209 210 211 212...

result:

ok n=488, m=621, k=100, w=25366544

Test #87:

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

input:

489 619
58852 40757 69236 191970 181662 101439 39432 6490 161229 73631 53295 122306 63605 19594 28537 84137 172434 5094 137599 134279 24280 179200 40496 162160 158208 187115 101767 189397 67073 94641 164410 6591 69447 195242 79689 28265 183000 184173 143138 31365 25985 85651 2999 22434 75518 123681 ...

output:

24824379 199
4 5 7 8 9 18 21 23 25 27 30 31 33 34 35 36 37 38 39 47 48 53 54 55 56 58 62 63 66 67 69 71 72 75 78 80 83 87 91 94 95 98 99 100 105 106 108 109 123 127 128 131 136 139 145 146 148 151 152 155 157 158 163 167 174 177 179 180 188 189 193 196 197 199 200 201 205 207 209 211 212 213 216 218...

result:

ok n=489, m=619, k=100, w=24824379

Test #88:

score: 0
Accepted
time: 16ms
memory: 3700kb

input:

490 627
135074 183660 68189 104546 19163 12779 56893 179136 197889 117099 172835 111310 152166 62201 166682 184239 121446 181536 185963 63235 117151 37200 144125 120935 1822 153571 60904 114634 15605 66212 51782 133165 12797 25386 124387 78514 162934 139594 151052 148807 66324 173097 59589 198351 15...

output:

25935823 201
0 1 2 5 8 9 10 12 14 17 18 29 31 32 34 35 36 39 41 49 50 52 54 55 56 57 60 61 64 65 66 67 68 71 72 73 78 81 82 88 90 93 94 96 97 99 102 103 106 108 109 112 113 115 119 121 122 124 125 127 132 133 135 138 146 149 150 152 154 157 158 167 169 172 173 175 176 178 179 181 183 185 186 187 188...

result:

ok n=490, m=627, k=100, w=25935823

Test #89:

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

input:

491 593
64736 189427 66092 35928 95886 183331 36792 36528 4794 90874 190834 88916 122507 56542 95703 112912 29927 198687 178890 84207 52605 134643 104060 100027 58900 199014 165571 38508 133532 15662 90223 93626 174949 172218 113039 79193 123790 28878 24884 60011 149195 88994 50668 24984 61015 18790...

output:

26273044 201
1 5 9 10 11 14 17 21 24 25 26 27 28 30 32 33 34 36 38 44 45 48 52 57 58 60 61 65 66 67 71 77 79 80 86 87 88 94 95 99 111 112 114 115 117 118 119 121 126 128 130 131 133 134 135 136 138 139 142 148 152 153 154 157 158 163 165 166 167 173 176 177 178 180 181 184 185 187 188 190 191 200 20...

result:

ok n=491, m=593, k=100, w=26273044

Test #90:

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

input:

492 623
181439 81264 28762 14618 160867 127378 68936 15056 31008 99333 120196 170963 147183 94947 116082 18536 150072 47630 100061 69944 165056 109064 7489 44831 189093 124586 57518 171123 7824 175774 85496 177723 28312 45856 143652 92477 174202 178547 55805 188438 90295 180702 11291 31763 127839 32...

output:

25129194 195
0 3 4 11 12 14 16 19 23 25 27 29 31 33 34 40 41 44 48 50 51 55 59 60 61 62 63 67 68 71 72 73 76 77 80 86 88 95 96 98 99 101 103 104 105 107 111 113 114 115 116 121 125 131 135 136 140 141 145 146 147 148 149 150 154 155 158 160 161 163 168 170 172 175 176 177 182 184 187 189 194 197 198...

result:

ok n=492, m=623, k=100, w=25129194

Test #91:

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

input:

493 618
10723 73788 167471 32907 27147 55138 90985 132400 154198 42087 81589 128878 78353 118541 46236 153434 9561 110849 121751 34343 50514 132797 46633 168835 194885 89302 17944 22539 161627 196674 133775 70439 177991 62161 18339 43015 199109 93709 73619 32416 191536 125679 133120 4543 48759 7623 ...

output:

24913746 200
2 4 6 7 10 11 15 18 21 23 28 29 30 31 32 33 34 40 41 42 53 54 55 58 59 63 64 66 69 71 72 80 81 84 85 87 88 89 91 92 93 95 97 98 101 105 109 110 115 117 118 122 123 124 125 126 128 129 130 134 136 137 142 144 145 147 153 154 156 159 161 163 168 169 176 177 179 180 183 184 186 188 189 190...

result:

ok n=493, m=618, k=100, w=24913746

Test #92:

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

input:

494 626
89037 39360 51150 144692 64805 183649 96187 7410 131952 58860 128171 25604 141830 76737 187165 74725 173982 187023 84166 189772 141176 79202 186569 52778 39331 169142 160879 61494 143196 89623 108807 72223 194515 100972 8450 65502 40169 19636 184399 165934 141110 24244 180721 32601 38480 991...

output:

25730737 201
3 5 6 12 14 20 22 25 26 29 31 32 39 42 43 47 50 51 52 53 54 59 64 65 68 70 71 76 78 80 82 83 84 85 89 91 95 96 97 99 102 103 104 105 106 107 111 114 115 117 119 121 123 125 127 130 134 137 142 144 147 150 157 160 162 165 166 170 171 174 175 177 178 179 180 183 186 192 193 194 195 198 20...

result:

ok n=494, m=626, k=100, w=25730737

Test #93:

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

input:

495 604
140985 134942 172765 116820 46540 114948 8670 157566 64490 171377 197596 120033 158312 171524 27263 167979 113085 188065 178713 76208 65100 1734 137511 17011 80463 111812 180591 101672 148457 175792 123891 50280 124381 85971 34287 30320 141039 134696 102828 53710 154223 161005 149380 175264 ...

output:

26574356 208
1 2 3 7 10 13 17 18 22 25 27 28 29 31 32 34 36 37 40 43 46 50 54 58 60 61 69 70 74 76 77 78 79 83 84 93 95 97 98 99 102 103 105 110 111 113 114 118 120 121 123 125 136 139 140 143 145 146 148 149 160 161 162 163 164 166 167 168 169 170 172 177 182 183 185 190 193 194 196 197 198 205 211...

result:

ok n=495, m=604, k=100, w=26574356

Test #94:

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

input:

496 603
194406 71552 98076 164565 169796 129265 195945 32580 191115 82049 26342 181978 8008 89285 126109 113896 14204 124115 143636 31296 123964 90443 157743 150722 151669 151040 25997 48269 20990 106169 109756 66263 157294 184275 177633 17417 146972 39687 38764 638 63183 55839 77011 157515 140204 1...

output:

25490958 204
0 1 2 3 4 5 6 8 11 13 14 15 17 18 21 22 23 27 28 29 32 33 36 39 41 47 48 49 52 54 61 64 66 67 68 70 71 72 74 75 83 84 85 86 87 88 91 93 94 95 97 98 99 102 104 106 107 109 110 111 114 115 116 124 128 136 138 140 144 146 148 150 152 155 156 157 159 163 165 166 168 172 175 176 178 180 182 ...

result:

ok n=496, m=603, k=100, w=25490958

Test #95:

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

input:

497 604
19522 19654 90300 186904 134627 99284 152969 35977 128194 198982 32162 181202 113000 186755 182885 22018 115405 194472 49642 51788 166993 183599 135186 148515 147951 153865 184270 94462 90318 81307 167661 81502 3044 194937 92961 136057 151944 68188 164552 121034 117304 113630 160687 34680 32...

output:

27374264 209
3 5 8 9 11 12 13 16 17 20 22 25 27 28 30 31 33 35 36 38 39 41 42 44 46 51 55 56 58 61 64 66 68 72 73 74 75 77 79 81 82 83 86 87 88 89 91 100 102 104 114 116 117 118 119 121 122 123 129 130 134 136 137 138 140 144 146 155 156 157 164 165 170 171 172 173 174 175 179 181 188 190 191 192 19...

result:

ok n=497, m=604, k=100, w=27374264

Test #96:

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

input:

498 598
118470 51623 2062 118383 173140 120129 73313 174368 100675 33458 178130 176382 160112 91051 171049 142928 124205 156373 158780 79326 63551 40977 183722 95426 78046 25631 134604 20425 52316 170323 136351 96939 156098 107926 132369 80966 87957 74479 126954 25205 159869 98645 171991 164772 8033...

output:

26274398 212
1 6 7 8 10 12 16 17 18 20 22 23 25 26 27 28 29 32 33 34 38 39 46 50 54 56 59 60 63 64 65 68 69 72 75 77 81 83 84 87 88 89 91 92 95 99 101 103 104 105 106 111 115 116 119 120 121 134 139 140 145 147 148 149 151 152 153 155 156 158 159 160 162 166 168 169 170 173 175 176 180 182 184 187 1...

result:

ok n=498, m=598, k=100, w=26274398

Test #97:

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

input:

499 637
84303 27533 75432 85891 136003 147668 127083 85967 102265 141901 196013 27401 61427 46382 48344 123412 129215 184771 163794 161504 67949 156463 115838 32543 120122 152108 118009 68708 117946 83662 66951 148769 70599 6739 13235 113263 89773 106831 170141 195845 61493 92693 73397 33375 9408 25...

output:

24416074 197
0 1 3 4 9 10 12 17 18 24 31 35 40 43 46 50 55 56 57 60 61 66 67 70 74 76 80 82 84 86 87 88 90 91 93 96 97 99 101 102 103 107 108 114 120 124 126 128 132 133 135 142 148 150 151 154 161 168 172 175 176 180 182 183 185 186 189 194 196 198 199 205 207 209 212 214 219 221 223 224 225 228 22...

result:

ok n=499, m=637, k=100, w=24416074

Test #98:

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

input:

500 640
130482 119949 135529 77607 177861 53916 46358 40008 103727 151500 79136 10282 159417 185432 34834 87290 29304 166705 153379 155979 17196 67055 55149 127742 65668 130669 172279 74629 42094 172872 104279 67948 143043 93864 37980 67545 9789 162050 189635 56886 104685 162215 151215 122668 34576 ...

output:

25542883 207
2 13 17 18 27 29 30 32 33 37 39 41 42 43 45 46 49 50 51 57 58 59 61 64 68 69 71 74 76 79 80 81 83 88 89 93 94 95 96 98 99 100 103 108 109 110 112 116 120 122 123 124 130 131 132 135 138 140 145 149 153 156 157 158 160 162 163 168 169 173 174 176 180 181 182 185 186 195 196 197 198 199 2...

result:

ok n=500, m=640, k=100, w=25542883