QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#698624#8787. Unusual CasemaspyAC ✓717ms21024kbC++2318.1kb2024-11-01 20:52:452024-11-01 20:52:46

Judging History

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

  • [2024-11-01 20:52:46]
  • 评测
  • 测评结果:AC
  • 用时:717ms
  • 内存:21024kb
  • [2024-11-01 20:52:45]
  • 提交

answer

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

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

#include <bits/stdc++.h>

using namespace std;

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

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

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

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

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

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

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

#define stoi stoll

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

template <typename T>
T floor(T a, T b) {
  return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
  return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
  return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

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

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

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

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

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

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

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

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

// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
  vc<T> B(len(I));
  FOR(i, len(I)) B[i] = A[I[i]];
  return B;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"

// Rewinding's implementation
// https://codeforces.com/blog/entry/90743
namespace hamil {
using pi = pair<int, int>;
using vi = vc<int>;
namespace LCT {
vector<vi> ch;
vi fa, rev;
void init(int n) {
  ch.resize(n + 1);
  fa.resize(n + 1);
  rev.resize(n + 1);
  for (int i = 0; i <= n; i++) ch[i].resize(2), ch[i][0] = ch[i][1] = fa[i] = rev[i] = 0;
}
bool isr(int a) { return !(ch[fa[a]][0] == a || ch[fa[a]][1] == a); }
void pushdown(int a) {
  if (rev[a]) {
    rev[ch[a][0]] ^= 1, rev[ch[a][1]] ^= 1;
    swap(ch[a][0], ch[a][1]);
    rev[a] = 0;
  }
}
void push(int a) {
  if (!isr(a)) push(fa[a]);
  pushdown(a);
}
void rotate(int a) {
  int f = fa[a], gf = fa[f];
  int tp = ch[f][1] == a;
  int son = ch[a][tp ^ 1];
  if (!isr(f)) ch[gf][ch[gf][1] == f] = a;
  fa[a] = gf;

  ch[f][tp] = son;
  if (son) fa[son] = f;

  ch[a][tp ^ 1] = f, fa[f] = a;
}
void splay(int a) {
  push(a);
  while (!isr(a)) {
    int f = fa[a], gf = fa[f];
    if (isr(f))
      rotate(a);
    else {
      int t1 = ch[gf][1] == f, t2 = ch[f][1] == a;
      if (t1 == t2)
        rotate(f), rotate(a);
      else
        rotate(a), rotate(a);
    }
  }
}
void access(int a) {
  int pr = a;
  splay(a);
  ch[a][1] = 0;
  while (1) {
    if (!fa[a]) break;
    int u = fa[a];
    splay(u);
    ch[u][1] = a;
    a = u;
  }
  splay(pr);
}
void makeroot(int a) {
  access(a);
  rev[a] ^= 1;
}
void link(int a, int b) {
  makeroot(a);
  fa[a] = b;
}
void cut(int a, int b) {
  makeroot(a);
  access(b);
  fa[a] = 0, ch[b][0] = 0;
}
int fdr(int a) {
  access(a);
  while (1) {
    pushdown(a);
    if (ch[a][0])
      a = ch[a][0];
    else {
      splay(a);
      return a;
    }
  }
}
} // namespace LCT
vector<vi> used;
unordered_set<int> caneg;
void cut(int a, int b) {
  LCT::cut(a, b);
  for (int s = 0; s < 2; s++) {
    for (int i = 0; i < used[a].size(); i++)
      if (used[a][i] == b) {
        used[a].erase(used[a].begin() + i);
        break;
      }
    if (used[a].size() == 1) caneg.insert(a);
    swap(a, b);
  }
}
void link(int a, int b) {
  LCT::link(a, b);
  for (int s = 0; s < 2; s++) {
    used[a].push_back(b);
    if (used[a].size() == 2) caneg.erase(a);
    swap(a, b);
  }
}
vi work(int n, vector<pi> eg, ll mx_ch = -1) {
  // mx_ch : max number of adding/replacing  default is (n + 100) * (n + 50)
  // n : number of vertices. 1-indexed.
  // eg: vector<pair<int, int> > storing all the edges.
  // return a vector<int> consists of all indices of vertices on the path. return empty list if failed to find one.

  LCT::init(n);
  if (mx_ch == -1) mx_ch = 1ll * (n + 100) * (n + 50); // default
  used.resize(n + 1);
  caneg.clear();
  for (int i = 1; i <= n; i++) used[i].clear();

  vector<vi> edges(n + 1);
  for (auto v: eg) edges[v.fi].push_back(v.se), edges[v.se].push_back(v.fi);

  for (int i = 1; i <= n; i++) caneg.insert(i);

  mt19937 x(chrono::steady_clock::now().time_since_epoch().count());
  int tot = 0;
  while (mx_ch >= 0) {
    //    cout << tot << ' ' << mx_ch << endl;
    vector<pi> eg;
    for (auto v: caneg)
      for (auto s: edges[v]) eg.push_back(mp(v, s));

    shuffle(eg.begin(), eg.end(), x);
    if (eg.size() == 0) break;
    for (auto v: eg) {
      mx_ch--;
      int a = v.fi, b = v.se;
      if (used[a].size() < used[b].size()) swap(a, b);
      if (used[b].size() >= 2) continue;
      if (x() & 1) continue;
      if (LCT::fdr(a) == LCT::fdr(b)) continue;
      if (used[a].size() < 2 && used[b].size() < 2) tot++;
      if (used[a].size() == 2) {
        int p = used[a][x() % 2];
        cut(a, p);
      }
      link(a, b);
    }
    if (tot == n - 1) {
      vi cur;
      for (int i = 1; i <= n; i++)
        if (used[i].size() <= 1) {
          int pl = i, ls = 0;
          while (pl) {
            cur.push_back(pl);
            int flag = 0;
            for (auto v: used[pl])
              if (v != ls) {
                ls = pl;
                pl = v;
                flag = 1;
                break;
              }
            if (!flag) break;
          }
          break;
        }
      return cur;
    }
  }
  // failed to find a path
  return vi();
}
} // namespace hamil

void solve() {
  LL(N, M, K);
  vc<pair<int, int>> edges;
  FOR(M) {
    INT(a, b);
    // must be 1-based index
    edges.eb(a, b);
  }
  vvc<int> ANS;
  FOR(K) {
    vc<int> path = hamil::work(N, edges);
    ANS.eb(path);
    set<pair<int, int>> used;
    FOR(i, N - 1) used.insert(mp(path[i], path[i + 1]));
    FOR(i, N - 1) used.insert(mp(path[i + 1], path[i]));
    vc<pair<int, int>> nxt;
    for (auto& e: edges) {
      if (!used.count(e)) nxt.eb(e);
    }
    swap(edges, nxt);
  }
  for (auto& A: ANS) print(A);
}

signed main() { solve(); }

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3936kb

input:

5 9 2
1 3
1 4
1 5
2 3
2 4
2 5
3 5
4 3
5 4

output:

3 2 5 1 4
1 3 5 4 2

result:

ok OK (n = 5, m = 9)

Test #2:

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

input:

10000 200000 8
6318 9948
9588 8985
4252 4927
1146 9347
2276 7434
9612 4436
8319 1837
4428 1043
5976 2759
879 1564
7866 4849
2070 5310
8407 156
7306 7766
9100 1576
1181 6122
7790 7065
3235 8877
5661 9718
1555 743
5479 9755
2601 8190
3318 2067
4084 8193
1050 269
64 5504
3416 5041
7169 197
2158 2523
57...

output:

2832 7002 1405 1129 6399 5495 9874 9823 7176 7117 75 5539 9690 7507 6979 8225 6405 4223 3444 9768 1817 6905 128 4044 6267 917 6084 6854 4210 423 3823 7526 9188 5199 7840 6031 8950 8902 9307 2169 3916 6967 9046 93 2934 9714 4144 52 5878 5067 1767 9538 3636 9606 6488 6897 8366 7066 8285 2339 4057 9147...

result:

ok OK (n = 10000, m = 200000)

Test #3:

score: 0
Accepted
time: 680ms
memory: 20420kb

input:

10000 200000 8
7826 9720
8400 2487
6964 6011
4799 6032
3696 3691
7883 4350
9092 3892
3588 7409
6005 4538
4196 7873
4216 4505
6339 1269
2405 5423
9 7030
8193 7285
5782 2768
5646 4946
4483 6857
3431 9325
4243 488
2435 8371
3067 1462
8592 4932
8581 3147
1394 6751
2499 4977
4806 1190
9652 5059
4075 3454...

output:

1336 5604 3384 9737 9606 6908 7745 7622 860 3764 7539 3705 4115 8486 723 8540 1063 3460 6483 8379 9906 7939 6840 3538 1724 5362 1610 3042 180 9769 5568 5891 5341 5933 8904 2932 8411 4593 5694 7821 120 8271 5345 9662 9678 9699 4051 2537 5113 6669 9490 4912 2679 1275 6545 5494 5498 147 9778 8717 8537 ...

result:

ok OK (n = 10000, m = 200000)

Test #4:

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

input:

10000 200000 8
6064 4200
2244 5165
648 6303
9246 8103
4187 7801
761 3539
6105 2254
4471 3158
6006 4452
3580 8120
9391 3711
8752 1014
2511 151
800 2285
5388 3282
4704 8712
5372 5509
6988 6976
9314 9056
2225 9256
8567 3853
4135 3386
9688 1467
7287 5856
8107 7114
2385 3663
2991 2969
3746 7352
8828 6735...

output:

1178 416 5746 5530 5189 7130 4439 4139 5533 3761 4461 8775 6772 299 8699 7912 6230 6191 1815 5076 2633 7872 7368 4937 5850 1544 8255 3852 7132 1153 6878 4447 4916 382 2804 7634 3526 2836 1513 1830 1705 6079 8988 8884 2675 7202 9008 3420 9582 8593 6459 9215 9958 9934 6707 8908 5905 5831 9989 4383 473...

result:

ok OK (n = 10000, m = 200000)

Test #5:

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

input:

10000 200000 8
1034 3387
1120 7020
5302 5802
4487 5560
3749 9763
8246 2002
9358 6922
7077 8289
5976 2501
9030 2306
3390 2468
9307 4546
8724 4342
9679 3531
684 9564
7946 3956
6968 8754
748 9234
3310 8909
5500 7046
3874 6201
5806 3962
6604 1672
203 6318
1189 1358
9723 1561
7970 380
9450 7078
6420 2366...

output:

4496 6424 7700 7948 5050 5401 6414 1936 5075 3636 5193 2763 6866 4901 9075 4040 4987 8609 8585 7435 5166 4727 1529 6018 8308 2231 185 4151 7233 6147 2263 7042 4852 1375 8602 6531 1139 5859 8383 720 6888 4873 8752 4124 6243 8380 7118 3789 3322 9948 3352 528 9235 32 7411 2587 9989 3343 4872 8458 7960 ...

result:

ok OK (n = 10000, m = 200000)

Test #6:

score: 0
Accepted
time: 662ms
memory: 19964kb

input:

10000 200000 8
2734 7281
5027 8050
927 4507
523 8404
2382 9578
337 9740
8851 7897
1407 2803
5918 8684
547 430
6215 775
8004 1864
1045 7995
6645 767
4082 6133
5510 8499
433 4681
5763 3631
5419 8885
4068 3859
8356 5416
8078 3190
9342 5547
7329 4533
639 9483
4511 8673
9744 3422
6765 4236
6849 346
2288 ...

output:

4517 697 3653 5230 2041 4749 3982 3145 1629 3742 6098 4525 9280 4607 4372 3051 774 2374 9832 2223 8177 6090 4234 2534 1441 4782 3682 2440 2280 2394 9849 6438 1040 1673 9700 8963 3549 1146 1562 125 6623 5609 7390 3920 4332 3435 7085 3372 5283 5427 6853 9862 5162 4530 8923 7044 9249 450 2704 2629 1884...

result:

ok OK (n = 10000, m = 200000)

Test #7:

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

input:

10000 200000 8
1166 5882
3966 8257
7523 2420
7353 6633
87 7247
7035 6751
4585 5179
7460 6699
5829 3002
8131 2493
7864 8632
4845 2969
9472 1110
1698 3993
5582 2988
7395 2341
5768 3290
2034 167
5642 8983
7929 9694
2014 1497
952 1069
7900 3092
8663 502
6458 1489
6751 4998
8312 2094
5690 8825
115 676
62...

output:

5048 5578 5911 5845 2406 2194 9216 485 2634 7289 5938 1486 9877 3744 1580 4340 4718 4229 6347 4461 4146 795 641 8985 9679 1036 4667 8603 7172 2325 7159 4129 7777 7240 6640 4488 3709 1193 6848 3527 225 2888 418 1138 6260 9766 8247 1638 7174 2725 1133 3276 2258 8399 4136 8535 5732 9777 8037 1008 6416 ...

result:

ok OK (n = 10000, m = 200000)

Test #8:

score: 0
Accepted
time: 717ms
memory: 19380kb

input:

10000 200000 8
6328 9191
7937 7640
5090 9539
4977 248
6863 2768
8341 3037
6559 8768
5237 9978
5712 5454
1782 8494
8338 6040
9828 7861
4008 3687
4839 3210
5183 130
3601 5482
2972 4581
9560 8842
3978 9205
7084 4551
4847 4445
4428 7601
2280 4306
4207 4225
8646 7376
6443 536
3674 6398
6226 847
6219 3356...

output:

1101 9010 2693 4878 7574 3664 2489 7752 9646 5375 3316 960 2713 8 13 9506 359 4646 9720 8342 4170 2686 4341 3103 10000 9698 5120 7018 804 1849 6033 9626 5997 7779 3403 128 9864 5836 4519 8946 9671 5598 901 9894 5045 8053 5244 1939 2512 439 1771 907 6019 7303 3637 9028 9329 8893 9914 1609 3584 2217 9...

result:

ok OK (n = 10000, m = 200000)

Test #9:

score: 0
Accepted
time: 667ms
memory: 19288kb

input:

10000 200000 8
8222 7206
6939 6199
3627 5866
3396 9250
2710 6141
4253 8597
4773 8663
4738 2640
5564 6042
1500 8433
7637 2998
2954 6540
4650 5727
6068 8417
2885 7557
4129 7922
2046 8554
8343 9655
428 9550
1531 8431
6855 4259
8506 2784
2481 9190
3961 5701
7203 7144
3585 5286
5830 6332
8372 300
5160 83...

output:

1934 8710 4404 1239 3768 7091 1290 6934 2710 9804 3562 5449 1732 1635 1759 4798 2640 4218 731 7016 6006 2832 5249 1489 3955 3034 5784 6217 9980 7204 6841 4713 2461 2078 9818 8861 7801 217 4770 4302 6806 8013 6082 6491 1606 322 4683 5693 279 4456 9150 3661 9135 7924 5846 6147 472 2000 9673 4132 9760 ...

result:

ok OK (n = 10000, m = 200000)

Test #10:

score: 0
Accepted
time: 673ms
memory: 20592kb

input:

10000 200000 8
6846 9929
974 3935
3136 1399
2610 3637
7628 7368
4772 3431
9227 4865
5962 4684
5388 4763
7285 2311
5760 9506
4223 9005
1401 7229
5384 9615
8690 5272
8977 9661
2990 5210
8380 2608
4990 18
1272 1334
8039 940
3186 6620
8503 7744
7924 4930
2128 794
8179 9250
4781 1898
2129 7185
6939 5764
...

output:

3860 8920 7170 4055 7774 6262 6794 7626 5746 639 2075 6235 4160 5701 1181 9587 9799 2003 1985 3334 1604 5241 9845 9635 951 247 679 4539 6571 1128 321 2602 6835 5954 2578 2250 7711 7906 8375 5289 7852 5837 6411 1007 2102 4993 3992 3582 180 8189 5193 9714 9930 2800 791 6839 3815 170 7593 9531 4179 513...

result:

ok OK (n = 10000, m = 200000)

Test #11:

score: 0
Accepted
time: 680ms
memory: 19344kb

input:

10000 200000 8
2202 7359
40 846
3615 6140
2618 3411
1618 6447
9897 7539
9921 7374
8909 6111
5182 1620
9136 127
2709 5565
3635 5257
4258 8192
2787 6804
2596 3272
8146 700
5803 4547
9673 7699
7666 608
6306 3259
8398 4487
8468 9107
347 9968
6096 1913
3422 8324
225 2426
526 3095
7496 1502
1556 5493
1173...

output:

4742 9862 889 6442 9491 2669 8404 9215 6192 8387 1059 7316 2087 2829 7434 879 3855 9176 4780 5942 7396 2689 9253 2555 5053 1840 1942 533 5442 6809 6833 8680 8284 9765 6807 4243 2212 925 7314 9276 6804 7408 6204 2711 7807 8809 129 5264 1537 8693 5726 4165 3213 244 2366 6680 4512 3027 1732 8088 2316 2...

result:

ok OK (n = 10000, m = 200000)

Test #12:

score: 0
Accepted
time: 653ms
memory: 20072kb

input:

10000 200000 8
4288 9496
4137 6934
5065 87
3420 8570
4679 3379
9630 921
6856 6189
3580 6921
4946 6611
7054 1882
8482 1173
1189 5296
3223 8618
8278 9983
4603 1559
1637 1037
487 6567
2222 4930
8456 1322
6633 4206
7932 4900
4352 246
8011 5862
8478 6650
1085 9736
9721 4816
3066 9922
4474 3251
9010 7571
...

output:

6868 1691 5351 8296 2435 456 7887 2783 6042 337 656 3213 5199 9463 2925 2368 8758 596 9683 5157 1644 7621 3058 9035 5890 9918 593 1434 1640 3688 6145 8052 1896 4207 4340 9766 5471 6526 9092 1915 4080 5573 965 8880 3031 117 1538 7133 3922 1734 3502 4336 4061 2143 3564 5496 6098 4957 4395 4140 87 8156...

result:

ok OK (n = 10000, m = 200000)

Test #13:

score: 0
Accepted
time: 690ms
memory: 20044kb

input:

10000 200000 8
3105 6341
3267 2198
7486 3241
5017 9116
6811 8164
3970 3578
30 1311
9975 7113
4681 9737
1039 7576
3081 6333
6886 9121
8295 8507
1857 9152
4712 132
9449 674
7039 1268
6027 4299
7358 2158
2254 4176
6642 2180
838 38
1497 5426
5069 9140
5117 5029
6669 6418
2399 2381
3063 2432
9302 1999
61...

output:

1665 9691 5815 2332 9883 2423 799 1758 3999 5045 648 6889 4330 6513 630 6877 1452 8637 7562 8301 1460 4790 8995 5479 9227 5229 3556 8855 850 8665 7121 9821 680 8489 6504 4315 9699 7038 6208 9074 459 9761 3487 2485 2338 2323 6937 6398 7777 3123 6767 6141 3766 4278 8513 6333 8710 686 2059 8422 8797 13...

result:

ok OK (n = 10000, m = 200000)

Test #14:

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

input:

10000 200000 8
8654 7892
7428 6639
878 5603
7408 5048
8014 802
2916 5509
9445 2740
8092 6688
4386 998
1091 7207
6504 1042
726 6733
9475 7857
3523 4312
2923 8991
1582 9609
5462 8652
1087 5808
4374 3117
3167 3169
4526 6326
7925 8481
804 8660
5869 9384
5517 4202
1069 7233
8527 470
3262 9045
2431 8777
5...

output:

7613 2815 2760 282 1132 2854 4846 1984 5790 3702 4211 7410 4364 9254 2934 4594 916 8679 7545 2216 5722 4892 2146 6098 3408 7405 4893 1620 8070 4630 7839 7456 3661 3418 4733 3996 7901 6964 7993 5891 2360 345 8193 3333 6150 2051 7009 4493 9702 5138 2068 2700 4886 4729 5474 1782 4612 4974 1734 2502 615...

result:

ok OK (n = 10000, m = 200000)

Test #15:

score: 0
Accepted
time: 667ms
memory: 19748kb

input:

10000 200000 8
933 4151
6621 255
5240 7171
594 6365
8289 1293
6469 6714
5100 476
7934 5646
4062 393
7210 778
8752 5302
2709 8132
6762 6670
3277 5462
9235 8137
8036 7844
5754 8718
7402 9455
9503 4199
9374 1184
1587 7339
5615 5576
5932 5563
879 7381
2286 7257
2919 7262
1450 4191
5071 3090
8398 7904
28...

output:

4439 4390 1773 3003 1148 9059 9756 3161 2634 3567 8525 5029 7082 2491 6252 1131 8803 2108 3837 8219 1840 5279 919 1052 3034 3389 6230 5188 8161 6889 7404 8379 8970 8152 8523 8282 9849 2527 428 6809 6873 20 1986 9737 2386 1775 3269 4765 6063 9823 8768 6599 3574 3717 7893 843 9066 6870 2758 738 138 34...

result:

ok OK (n = 10000, m = 200000)

Test #16:

score: 0
Accepted
time: 659ms
memory: 19064kb

input:

10000 200000 8
9943 5117
846 3048
573 7946
4574 3069
7634 9636
4629 7193
6995 4518
9499 3986
3709 7923
9395 8286
9824 9113
2834 3317
156 4944
1118 2603
3649 7569
8811 5378
7915 1466
4973 5241
2746 5405
874 8222
7822 5218
3907 1322
6881 6137
98 3131
5423 4193
2221 6503
1167 3542
8491 4566
7202 9381
8...

output:

5114 2686 5306 8469 8305 8596 818 8995 9839 7553 47 6964 6378 9553 5780 465 4598 590 9399 3290 8325 9216 848 5867 7297 7964 1854 3481 483 7831 4054 2444 2822 2572 5044 1589 7123 8061 7768 8375 597 6534 4097 4494 9335 3707 4300 7533 7531 7101 1674 8493 8783 967 9126 1141 2201 8147 4347 6676 1679 7662...

result:

ok OK (n = 10000, m = 200000)

Test #17:

score: 0
Accepted
time: 684ms
memory: 19804kb

input:

10000 200000 8
5685 790
102 5017
6877 7928
9348 5159
6051 5832
7396 6946
5130 4867
2787 1709
3325 3587
7648 9733
9722 2473
1102 2289
9658 2681
7046 5735
6164 7288
3907 2211
1947 6896
3800 3166
4102 6733
7667 4282
3233 9964
2800 5721
3651 380
3526 6635
4930 5010
8974 4957
7678 8525
3522 3474
8844 320...

output:

1587 4706 207 1666 8006 5188 6093 9757 5170 5216 9524 654 6885 3529 4259 3770 9541 8170 6947 2581 6101 8309 3463 1245 6886 85 3765 5697 5092 5874 2349 4028 655 3515 2744 1382 4700 7437 6100 7577 2072 402 1493 6302 2103 8081 5263 2622 7390 1508 6092 15 1943 4789 7744 2500 5807 947 2841 2750 5382 7897...

result:

ok OK (n = 10000, m = 200000)

Test #18:

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

input:

10000 200000 8
8157 1170
4391 6162
4152 7117
4917 2635
3540 9882
4770 5974
9506 1523
7799 8814
2913 7387
1967 5119
8444 5384
7513 5048
5267 9880
1062 4857
6781 7292
3324 8343
7848 5008
3882 3230
3571 8184
9753 9364
7819 1576
2296 8772
6243 8293
1164 7893
805 9708
3179 2624
983 9138
163 9815
3323 938...

output:

534 4451 3451 5380 471 3763 4686 9257 1818 9738 2411 3134 7975 798 9355 3242 7501 4660 4358 7953 3267 9479 4966 8035 9769 5750 4330 4685 7223 6222 9926 5106 2542 4775 8507 7876 9267 6929 2965 5021 1482 1664 38 662 8931 9234 4213 7077 7882 72 9067 775 2467 6348 5033 2840 2310 3150 6218 2395 2019 6434...

result:

ok OK (n = 10000, m = 200000)

Test #19:

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

input:

10000 200000 8
7360 6258
3711 6484
2398 5513
1280 5497
99 1783
6751 4276
121 4485
4535 5302
2471 9321
2353 4443
5992 7845
2067 1594
6983 6541
3166 9969
5499 7584
7063 3774
5618 5802
5220 5433
1153 9758
7132 3469
1580 55
2393 474
4655 9876
3012 6904
3048 8287
4835 9504
1083 5383
8414 3587
640 7909
12...

output:

5940 4277 5103 4591 6893 7337 718 8829 3698 9622 2852 9924 6233 3817 8505 9255 4874 2077 8422 8827 8029 9907 2283 5530 8455 1325 1912 4731 1914 4289 5909 331 8754 5129 6988 1704 316 1492 6070 687 582 8147 367 2774 1891 7747 3299 9420 730 9428 9506 6790 7636 5661 9135 8672 6271 7755 9703 4581 4742 22...

result:

ok OK (n = 10000, m = 200000)

Test #20:

score: 0
Accepted
time: 678ms
memory: 19868kb

input:

10000 200000 8
3294 6053
8062 5981
1615 3116
8438 3745
5730 1538
3338 1852
6977 3755
2994 1173
1999 9389
8805 7705
2364 9857
4763 1926
4807 2665
3357 1072
2320 8161
5122 8504
5259 9278
7813 9775
6849 1454
9805 6597
4517 5400
3093 829
8889 5129
9068 3669
1661 747
3942 5597
7977 7258
8276 4791
794 878...

output:

6637 5658 7042 3525 2466 7301 5487 2947 5645 9530 9262 2375 5446 6120 4536 6043 9924 3283 9347 2365 1870 6988 9364 8961 4686 3401 4625 3923 4594 7525 3232 4431 2160 9489 4216 3248 4457 3009 8649 746 3057 1302 3271 3047 7650 2832 8523 2487 9077 2058 8448 8605 9575 5942 2404 8540 9332 988 5049 4705 25...

result:

ok OK (n = 10000, m = 200000)

Test #21:

score: 0
Accepted
time: 661ms
memory: 19700kb

input:

10000 200000 8
5960 554
7446 4655
1802 9926
6390 7380
432 9145
4532 8702
73 9330
3176 6426
1498 7593
1325 4906
7561 1419
5603 6045
8738 8250
1636 8165
7241 9025
7503 2533
6769 5436
1662 6255
658 3274
7771 8747
6629 7611
4394 9835
8944 4052
9334 8187
6642 7088
500 903
1665 4765
9749 3427
3786 2010
29...

output:

3237 4540 2303 1435 8693 8995 7796 176 6460 9232 8118 2017 8163 8270 3501 9579 5170 7004 8687 4681 1328 5048 5973 3848 1941 1001 2374 9657 6077 2237 3076 6474 5538 2214 2144 865 2614 128 1209 1387 1140 8228 1760 6993 950 4032 3395 3443 2375 3857 7191 4098 1618 3112 4783 3403 3868 4358 7790 3708 7334...

result:

ok OK (n = 10000, m = 200000)

Test #22:

score: 0
Accepted
time: 655ms
memory: 19464kb

input:

10000 200000 8
5356 9763
1861 2505
2960 5943
5137 6400
4205 4606
334 4826
9409 1213
5082 1062
968 3931
9911 6045
1583 2531
4585 3950
8777 3298
8002 1249
265 175
4205 5862
148 4277
6766 4875
2580 5217
1030 9919
7916 6689
6297 7493
4820 6644
3810 458
7992 7311
4510 5422
2148 7902
2832 9495
9616 7585
5...

output:

4390 2191 5629 6828 3990 9312 1706 4403 4829 1207 1547 9648 6628 8330 7934 3449 3198 1364 9887 4659 3993 5868 3605 5333 8395 871 7596 6414 4991 7917 5702 4821 2465 2216 2570 8746 9884 9381 4087 3326 8992 864 5611 7460 5135 5122 7898 3239 4760 4372 2041 4082 5472 5223 6236 9691 9672 8061 3478 81 7809...

result:

ok OK (n = 10000, m = 200000)

Test #23:

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

input:

10000 200000 8
1483 3680
1308 9532
5089 1166
4678 806
7049 7919
742 225
4985 9402
8711 5081
408 8403
4565 1123
4429 3193
1709 5643
4923 7808
2456 324
1389 1611
5228 8489
5397 5799
3126 5633
2616 7282
9582 114
8379 2634
8802 3804
6517 2907
2495 483
5711 1414
5972 9154
9425 6671
7526 2994
8283 5509
64...

output:

6993 4533 3602 1403 5738 5100 9953 2061 6453 9790 5538 4078 2000 6514 1867 320 6587 2656 5495 723 4198 5174 3467 1276 4899 7825 5583 551 6936 9557 9243 8184 9477 7416 4758 3951 3505 5009 8455 1460 371 7113 6507 9620 7346 6754 5334 855 2323 2396 787 4619 713 3477 2329 5207 6764 3691 4976 2725 8937 18...

result:

ok OK (n = 10000, m = 200000)

Test #24:

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

input:

10000 200000 8
4341 2303
5786 5734
8189 5597
5013 599
8965 9085
5757 4898
6801 3898
4064 8482
9819 1010
5285 139
6101 3406
6977 1121
7176 1780
4997 5389
616 3334
572 416
2516 4
742 8531
765 9471
3427 9332
8017 5445
1909 8766
4035 2839
5389 8262
9798 9399
4884 2098
3496 1070
3830 3926
9787 5783
4993 ...

output:

953 6907 7932 1705 1819 2559 4917 9378 9403 246 6526 8845 6318 5783 272 1813 8990 3777 1220 6643 297 5278 3779 4337 5225 2078 5985 4741 7465 8312 1565 4069 2245 7972 4355 7071 6006 4583 9870 9858 9337 9865 217 3723 609 6351 4252 4899 7654 8601 260 6062 882 1845 6263 1772 1811 5104 9921 7952 5933 634...

result:

ok OK (n = 10000, m = 200000)

Test #25:

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

input:

10000 200000 8
3930 5634
5297 1113
2260 9235
6143 5777
9951 8103
5378 8844
4858 4701
1141 1266
9200 1752
2072 3094
6597 3169
5537 5214
5626 6444
7944 5343
237 1641
1505 6890
9613 3567
7027 1782
2566 7572
6830 5122
5618 2380
7375 6441
2493 3794
254 1264
1248 4256
4362 1100
1744 2290
4130 8407
1501 86...

output:

2895 3866 380 5233 8487 4720 5627 6820 5080 3062 8375 816 4540 9617 3956 6532 9693 2316 3228 1120 9242 8280 2979 4299 5524 575 103 9648 7219 1630 4788 9959 9673 4565 7195 5604 7095 2847 2105 8768 1287 131 2477 3471 530 1574 4107 7596 9714 5818 8681 8198 1761 7294 1435 324 1364 8852 7648 7652 9202 53...

result:

ok OK (n = 10000, m = 200000)

Test #26:

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

input:

10000 200000 8
250 3672
9839 5668
7301 2079
8067 6342
9 4975
9607 2066
9155 1811
9941 3432
8551 629
4925 9987
5919 2483
1940 3439
5 8111
4342 3490
3374 7638
4223 2166
2363 6459
9739 743
1402 4217
6997 4834
4819 1666
9929 4646
6536 3713
3806 7080
7079 7011
5063 5627
2022 6762
1269 8085
1309 3380
5929...

output:

2881 4384 833 8294 429 7189 853 8472 5678 7968 495 5486 4156 3012 5925 196 6690 4300 8953 3053 2237 7254 5150 1958 3202 3588 5813 270 5169 3415 7394 8337 8798 8204 728 9965 7450 1451 1419 1041 5008 7120 9470 8046 9341 8686 4095 5693 3292 8761 4354 5400 4242 2610 1170 9710 882 8910 8796 7967 6069 503...

result:

ok OK (n = 10000, m = 200000)

Test #27:

score: 0
Accepted
time: 700ms
memory: 19928kb

input:

10000 200000 8
3302 6417
9413 9399
3313 4131
786 2293
9139 9699
8443 4561
9691 5227
464 4981
7873 7640
3846 819
4065 1347
1636 278
581 470
1146 6526
6905 220
2531 1990
5091 8710
1122 57
3891 6774
6722 1119
1982 5076
4842 5563
1517 4655
9328 8119
273 6638
6329 6210
6476 8054
2405 1312
1326 703
8278 3...

output:

5697 3732 1158 3784 7471 4443 9896 2345 6165 4916 2019 4213 508 6055 5456 2765 3520 3953 6270 1421 8203 2517 248 3095 5408 9771 2710 9551 5574 2678 74 3544 1478 9557 769 4953 7233 8097 140 1714 2239 2628 9476 4436 9219 196 4621 3999 8671 566 9881 1359 70 7263 9901 9750 6936 6069 5703 7685 9935 9385 ...

result:

ok OK (n = 10000, m = 200000)

Test #28:

score: 0
Accepted
time: 716ms
memory: 19352kb

input:

10000 200000 8
3084 3869
4018 2306
296 5389
4299 3629
7339 2276
1885 6331
6469 4950
2711 5913
7166 2786
8833 5589
1036 9761
9475 904
7264 2290
6037 5553
8538 3088
5159 1113
9688 3643
3759 1510
4493 9454
1740 6427
8322 5352
357 5133
2320 9267
9060 6912
9835 147
5047 6007
7724 4978
5151 1971
4181 376
...

output:

4471 7070 8553 9390 362 1782 3554 7381 1600 7749 9728 2692 4085 1648 3942 5841 4125 622 7326 2472 1322 516 13 3304 9516 4760 2954 7633 7210 2884 9945 4515 7696 8105 5894 4523 1198 5565 2894 1589 5235 365 8729 2102 4822 9363 4217 5402 1750 7689 1256 614 2598 2518 1892 9513 5091 1669 7453 6768 9663 36...

result:

ok OK (n = 10000, m = 200000)

Test #29:

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

input:

10000 200000 8
9597 6028
3656 4390
8250 5855
8607 352
4611 2706
9934 7374
9486 979
6681 6227
6429 6067
9887 4297
6831 7725
5456 5316
54 3573
9016 570
8272 6242
2109 9535
6155 1258
7653 5102
3208 2257
2051 757
3836 2495
6474 3355
8945 7549
3001 3458
5766 7537
1216 5016
5767 7532
9508 62
9873 2398
673...

output:

1720 2881 4397 5537 6840 5282 7173 4857 2909 1936 9701 9308 4499 4280 8988 7212 8974 7144 9321 183 3258 2863 1554 6806 9635 5525 5950 3502 8129 9800 8216 1335 978 7290 6916 6987 849 2127 5425 5791 5009 877 6967 6914 4660 6527 4638 9741 2708 3801 3408 4374 1524 2292 5890 668 1886 8984 1535 1093 6866 ...

result:

ok OK (n = 10000, m = 200000)

Test #30:

score: 0
Accepted
time: 698ms
memory: 19872kb

input:

10000 200000 8
2841 2895
8325 5650
7175 5527
3709 2461
954 989
2590 7692
8743 3316
2375 5924
5663 7482
7008 6944
1452 5240
9580 3515
8952 4318
82 1578
6108 9683
3380 7256
4492 1555
2801 833
37 5183
7656 4109
8526 6505
3193 228
1390 9500
1152 7758
8065 8808
4837 3239
605 5717
5475 5585
8403 6770
2849...

output:

1416 421 7829 4186 4899 9431 7807 7501 271 5230 2127 6515 3072 3582 8360 7894 6068 5662 716 2387 9740 7922 2760 6636 2811 2792 7508 1439 301 7086 2954 1924 3457 1766 5952 6072 197 570 432 5517 1205 4193 7218 5195 3655 5194 3135 756 4628 1538 3264 9352 1426 5494 7132 4 1328 1815 6534 4124 4496 9548 5...

result:

ok OK (n = 10000, m = 200000)

Test #31:

score: 0
Accepted
time: 671ms
memory: 19704kb

input:

10000 200000 8
2816 4469
8026 6086
7071 4407
9605 9956
6368 7125
9853 7284
4241 1959
9793 5004
4867 7032
196 3530
4897 2305
1847 5501
3957 4526
9236 8577
2046 3410
8972 4276
4699 4534
9206 8703
4979 8232
8553 6484
2391 7381
513 5754
9656 5122
3511 9811
6734 3960
5908 674
2236 9534
3053 8540
9771 349...

output:

2473 7622 4253 1552 2336 8200 9425 2211 8305 3308 3332 1392 5142 1565 5674 2466 9238 5219 2299 287 4287 3960 8542 1555 8441 2923 1641 6325 6237 8402 9265 5753 5294 5650 4501 2647 3644 921 801 5063 4708 5308 2929 5076 1920 1698 6262 4178 2749 2693 9634 2362 3533 5738 8214 232 6065 9448 1071 9082 7494...

result:

ok OK (n = 10000, m = 200000)

Extra Test:

score: 0
Extra Test Passed