QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#106499#5260. The GamemaspyAC ✓3ms3492kbC++2315.3kb2023-05-17 21:58:442023-05-17 21:58:47

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-17 21:58:47]
  • Judged
  • Verdict: AC
  • Time: 3ms
  • Memory: 3492kb
  • [2023-05-17 21:58:44]
  • Submitted

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 3 "main.cpp"

void solve() {
  vi A = {1}, B = {1}, C = {100}, D = {100};
  VEC(int, DRAW, 98);
  reverse(all(DRAW));

  vc<int> HAND;
  FOR(8) HAND.eb(POP(DRAW));

  auto play = [&]() -> void {
    // backward trick を使おうとする
    FOR(i, len(HAND)) {
      if (HAND[i] == A.back() - 10) {
        A.eb(HAND[i]);
        HAND.erase(HAND.begin() + i);
        return;
      }
      if (HAND[i] == B.back() - 10) {
        B.eb(HAND[i]);
        HAND.erase(HAND.begin() + i);
        return;
      }
      if (HAND[i] == C.back() + 10) {
        C.eb(HAND[i]);
        HAND.erase(HAND.begin() + i);
        return;
      }
      if (HAND[i] == D.back() + 10) {
        D.eb(HAND[i]);
        HAND.erase(HAND.begin() + i);
        return;
      }
    }
    // 差分を minimize するような置き方を選ぶ
    // 同じ場合は、左のカード、上の山
    FOR(diff, 1, 101) {
      FOR(i, len(HAND)) {
        if (HAND[i] == A.back() + diff) {
          A.eb(HAND[i]);
          HAND.erase(HAND.begin() + i);
          return;
        }
        if (HAND[i] == B.back() + diff) {
          B.eb(HAND[i]);
          HAND.erase(HAND.begin() + i);
          return;
        }
        if (HAND[i] == C.back() - diff) {
          C.eb(HAND[i]);
          HAND.erase(HAND.begin() + i);
          return;
        }
        if (HAND[i] == D.back() - diff) {
          D.eb(HAND[i]);
          HAND.erase(HAND.begin() + i);
          return;
        }
      }
    }
  };

  while (1) {
    int now = len(HAND);
    play();
    play();
    if (len(HAND) != now - 2) break;
    if (len(DRAW)) HAND.eb(POP(DRAW));
    if (len(DRAW)) HAND.eb(POP(DRAW));
  }

  reverse(all(DRAW));

  print(A);
  print(B);
  print(C);
  print(D);
  if (len(HAND)) print(HAND);
  if (len(DRAW)) print(DRAW);
}

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

詳細信息

Test #1:

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

input:

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

output:

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

result:

ok 5 lines

Test #2:

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

input:

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

output:

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

result:

ok 5 lines

Test #3:

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

input:

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

output:

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

result:

ok 5 lines

Test #4:

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

input:

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

output:

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

result:

ok 6 lines

Test #5:

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

input:

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

output:

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

result:

ok 5 lines

Test #6:

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

input:

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

output:

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

result:

ok 6 lines

Test #7:

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

input:

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

output:

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

result:

ok 6 lines

Test #8:

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

input:

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

output:

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

result:

ok 6 lines

Test #9:

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

input:

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

output:

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

result:

ok 6 lines

Test #10:

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

input:

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

output:

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

result:

ok 6 lines

Extra Test:

score: 0
Extra Test Passed