QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#280503#7757. Palm IslandmaspyAC ✓7ms5260kbC++2012.7kb2023-12-09 16:32:122023-12-09 16:32:12

Judging History

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

  • [2023-12-09 16:32:12]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:5260kb
  • [2023-12-09 16:32:12]
  • 提交

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;
using u128 = unsigned __int128;
using f128 = __float128;

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); }
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;
}
#endif
#line 1 "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;

#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"

void solve() {
  LL(N);
  VEC(ll, A, N);
  VEC(ll, B, N);
  for (auto& x: A) --x;
  for (auto& x: B) --x;

  vi pos(N);
  FOR(i, N) pos[B[i]] = i;
  FOR(i, N) A[i] = pos[A[i]];

  string ANS(N * N, '1');
  FOR(i, N * N) {
    if (i % N == N - 1) { continue; }
    int p = i % N;
    int q = p + 1;
    if (A[p] > A[q]) {
      swap(A[p], A[q]);
      ANS[i] = '2';
    }
  }
  FOR(i, N) assert(A[i] == i);
  print(ANS);
}

signed main() {
  INT(T);
  FOR(T) solve();
  return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

221111111
2111111111111111

result:

ok Correct. (2 test cases)

Test #2:

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

input:

200
3
3 1 2
2 3 1
4
2 4 1 3
2 1 4 3
4
1 4 2 3
2 1 3 4
5
4 3 2 1 5
2 4 5 3 1
5
2 1 5 4 3
5 2 4 1 3
4
4 3 1 2
1 2 4 3
3
1 2 3
3 1 2
4
1 4 2 3
2 1 4 3
4
1 3 2 4
1 4 3 2
3
3 2 1
1 3 2
3
2 3 1
1 3 2
4
1 4 3 2
3 1 2 4
3
1 2 3
1 3 2
3
3 2 1
2 3 1
5
5 1 3 2 4
2 4 5 1 3
4
4 3 1 2
1 4 3 2
4
1 3 4 2
2 4 3 1
3
...

output:

121211111
1211111111111111
1221211111111111
1212121211111111111111111
1221121111111111111111111
1221221111111111
121211111
1211211111111111
1121121111111111
121211111
221211111
1221211111111111
121111111
211111111
1122112211221111111111111
1211211111111111
2221221121111111
221111111
1111111111111111...

result:

ok Correct. (200 test cases)

Test #3:

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

input:

200
5
5 1 3 4 2
5 3 2 4 1
5
5 1 2 4 3
3 5 4 1 2
5
1 4 5 3 2
2 5 4 3 1
5
1 5 4 3 2
4 5 2 3 1
5
2 3 4 5 1
5 4 3 2 1
5
1 5 2 4 3
5 3 1 2 4
5
1 2 4 3 5
4 2 3 5 1
5
3 2 1 4 5
4 2 3 1 5
5
3 1 2 5 4
2 4 1 3 5
5
5 3 1 4 2
2 5 4 1 3
5
5 4 3 1 2
2 5 4 1 3
5
3 4 5 2 1
3 5 1 4 2
5
4 5 1 3 2
4 2 3 1 5
5
1 3 4 5 ...

output:

1222111211111111111111111
1122112211121112111111111
2222121211121112111111111
2222121211111111111111111
2221122111211111111111111
2112111211121111111111111
2222121111111111111111111
2121112111211111111111111
2212121211121111111111111
1222112211121112111111111
1122111211121112111111111
12121112111111...

result:

ok Correct. (200 test cases)

Test #4:

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

input:

100
5
1 2 5 4 3
2 4 5 3 1
6
6 1 5 2 4 3
1 4 5 6 2 3
3
2 1 3
1 2 3
5
5 3 4 2 1
1 2 3 5 4
10
5 9 4 2 6 10 7 8 3 1
1 3 4 10 5 7 2 9 8 6
10
5 9 10 7 8 3 4 6 2 1
2 7 4 3 10 9 5 8 1 6
8
1 7 4 6 3 5 2 8
3 5 1 4 6 8 7 2
4
2 3 4 1
1 4 2 3
7
3 7 4 6 2 1 5
5 6 7 3 4 1 2
8
2 1 4 7 8 3 6 5
5 2 7 4 3 1 8 6
4
3 2 ...

output:

2222112111111111111111111
221211112111121111111111111111111111
211111111
2122112211221112111111111
1221222221211221221111221221111211221111111221111111221111111221111111221111111121111111111111111111
2221221221221221211121221211111221211111121211111111211111111211111111211111111111111111111111111111...

result:

ok Correct. (100 test cases)

Test #5:

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

input:

100
10
6 9 8 10 4 3 7 1 5 2
3 4 1 8 7 2 10 9 6 5
10
8 1 4 7 9 3 10 2 5 6
7 3 6 5 10 2 1 8 4 9
10
10 1 8 2 3 7 5 4 6 9
9 5 6 10 7 1 3 4 8 2
10
9 1 2 5 6 4 3 10 8 7
8 1 10 3 6 5 7 4 9 2
10
4 9 2 8 1 5 3 6 7 10
6 1 7 10 5 8 3 4 9 2
10
6 3 2 9 5 4 8 7 1 10
4 6 10 9 3 2 7 1 8 5
10
8 1 3 9 6 2 4 5 7 10
9 ...

output:

2222222121222222121112222121112212121111212111111111111111111111111111111111111111111111111111111111
2121222221121222221121222221111222221111111221111111221111111121111111111111111111111111111111111111
11122222211122222211112212211112212211111212211111212211111112211111111211111111211111111111111111...

result:

ok Correct. (100 test cases)

Test #6:

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

input:

20
6
3 1 4 6 2 5
6 2 5 4 3 1
44
28 15 14 27 17 41 25 23 7 8 26 30 44 32 6 21 35 33 22 24 9 16 5 34 39 42 3 11 40 10 43 31 37 20 38 18 1 4 12 36 19 2 29 13
43 25 20 4 14 22 18 26 42 13 2 31 33 19 41 11 27 40 35 38 23 28 16 44 6 17 5 3 29 37 34 21 36 8 32 24 39 9 12 30 10 1 15 7
14
3 5 12 7 14 1 4 13 ...

output:

122221222211222111111111111111111111
12222221222222222222222222222222222222222221221222122222222222222222222222222222222222111122211212222222222222222212222221222222211112211121212222211222222221222222122222221111121112121222221122212222122222212222222111112111211121222112221222212222221212222211111...

result:

ok Correct. (20 test cases)

Test #7:

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

input:

20
50
4 42 15 50 26 41 35 16 10 49 28 14 23 48 43 45 29 31 36 17 32 5 30 25 2 24 21 20 12 39 11 13 1 27 47 7 46 33 3 44 19 38 34 18 37 6 8 9 40 22
31 45 2 42 32 6 46 20 8 4 40 14 26 28 25 44 27 34 48 15 11 3 38 22 50 33 5 16 47 35 37 18 10 12 9 13 39 17 24 43 21 19 41 29 23 1 7 36 49 30
50
7 5 12 8 ...

output:

211212221222222222222122222222222222222222222222211121121122122222122212222222222222222222222222221111111112212221212221222222222222222222222222222111111111221212121222122222222212212222222222222211111111122121212122212222222221221222222222222221111111112212121212221222222222122122222222222222111111...

result:

ok Correct. (20 test cases)

Test #8:

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

input:

10
71
20 30 27 60 41 33 44 9 64 11 70 42 12 46 37 29 18 13 10 57 5 66 1 38 54 61 2 69 15 68 50 63 21 7 52 4 25 32 59 31 36 56 16 40 28 65 39 53 48 35 55 23 62 17 67 6 22 34 14 49 45 19 71 51 43 58 24 8 3 26 47
67 6 57 64 39 41 26 70 37 4 31 33 50 38 12 14 25 66 71 49 27 10 36 7 28 34 46 52 1 19 22 2...

output:

221222222222222212222222222212222222222212222221222222222222222222222212122212222222221221222222221222222222221222221112222222222222221222221112211222222222122122222222122222222222122222111222222222222222122222111221122222222112212221221212122222222212222211122222222222222212222211111112122222111221...

result:

ok Correct. (10 test cases)

Test #9:

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

input:

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

output:

112212222221222222222222222222222222222222222222222222222222222222222222222222222222222222222222222112212222221222222222222222122212222222222212222222222222222222222222222222222222222222221222222222112112221211212222222222222122212222222222212222222222222122222222222222222222222222222221222222222111...

result:

ok Correct. (10 test cases)

Test #10:

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

input:

5
185
176 145 128 100 85 172 45 103 170 18 19 115 65 156 70 136 22 184 69 126 142 25 5 137 55 31 93 163 58 8 13 149 62 114 165 86 54 169 124 140 134 88 160 77 113 68 150 168 56 112 10 185 57 71 74 138 181 59 183 151 174 33 27 61 82 164 6 34 161 84 178 157 48 1 73 119 146 153 78 135 94 47 95 14 90 10...

output:

122222222222222222222222222222222222222222222222112222222222222222222222222222222222222222222222222222121222222222222222222222222222222222222222222222222222222222222222222222222222222211121122221222222222222222222222212222222222222211222222212222222222222222222222222222222222222222222212122222222222...

result:

ok Correct. (5 test cases)

Test #11:

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

input:

5
200
168 131 23 136 98 121 183 12 172 57 84 104 115 19 102 122 159 11 36 196 81 92 128 47 109 130 45 195 193 171 62 126 111 154 118 190 59 123 185 91 90 75 71 116 66 177 82 78 38 165 182 163 151 197 129 103 145 176 175 63 147 93 157 191 31 142 76 88 61 55 180 51 117 14 105 80 140 119 173 4 178 127 ...

output:

222221122212222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221222222222222222222222222211122112221222222222222222221222222222222222222222222222221222222222222222222222222222222222222222222...

result:

ok Correct. (5 test cases)

Test #12:

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

input:

3
194
162 24 135 168 10 122 13 151 177 189 54 49 57 178 111 171 40 82 78 139 48 59 187 18 66 33 43 38 83 141 117 7 15 137 42 184 23 182 108 179 87 174 134 173 30 149 169 110 31 183 77 94 14 84 150 107 64 103 188 120 140 50 80 156 193 105 170 55 155 157 161 81 95 4 160 26 131 118 63 32 89 36 17 106 3...

output:

212222222222222222222222212222212222222222222222222222212222222222222222222222222222222222222222222222122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222211212222222222222222222221222221222222222222222222222221222222222222222222222222222222222222222222222212222...

result:

ok Correct. (3 test cases)

Test #13:

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

input:

3
300
243 210 61 250 118 147 32 124 158 207 30 180 141 104 107 45 8 238 128 6 215 22 136 100 72 25 209 98 166 240 48 20 290 185 53 11 157 223 55 173 224 35 9 40 78 189 75 116 108 246 203 162 133 298 143 254 106 81 169 279 146 187 96 154 241 83 252 50 13 139 159 276 278 218 54 21 256 145 150 151 120 ...

output:

112222112221222222222212212222122212222222222221222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222122222222222222222222222222222222222222222222222221...

result:

ok Correct. (3 test cases)

Test #14:

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

input:

2
14
4 2 6 13 12 14 10 9 3 1 11 8 5 7
1 12 7 2 5 4 14 13 6 11 3 8 9 10
354
55 14 267 112 280 42 116 251 214 3 289 244 278 208 213 103 1 340 60 348 32 187 223 53 92 311 221 266 227 158 269 261 160 257 234 107 143 225 319 12 177 182 228 268 307 317 75 322 25 109 129 17 285 203 46 188 263 70 125 27 306...

output:

2122212222222111221122222211121111221221112111121122111111112112211111111211221111111121122111111112112211111111211221111111111112111111111111211111111111111111111111111111111111111111111111111111
2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct. (2 test cases)

Test #15:

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

input:

2
500
67 401 380 460 9 93 425 417 491 233 386 355 126 352 114 207 195 317 446 254 98 180 441 259 232 84 500 365 271 62 135 444 315 379 27 63 103 100 482 282 281 457 161 295 234 321 320 47 407 35 424 456 108 111 116 144 427 452 432 480 42 278 139 405 375 13 296 344 228 335 377 305 19 400 495 349 39 4...

output:

211222222222222222222222222222222222222222222222221222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct. (2 test cases)

Test #16:

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

input:

2
124
116 119 55 10 34 52 91 60 88 82 22 72 89 32 74 54 65 77 24 16 103 56 71 70 99 113 105 31 47 101 63 104 46 85 124 78 53 87 27 26 18 38 19 80 6 67 95 97 44 7 114 121 102 86 118 93 94 41 117 109 106 66 111 123 5 84 69 48 29 61 42 11 59 35 3 37 83 92 8 23 4 28 40 12 45 120 62 112 43 90 58 57 81 51...

output:

112222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222111121222222222222222222222222222222222222222222221222222222222222222222222222222222222221212222222222222222222222222222222111111122222212222222222222222222222222212222222221222...

result:

ok Correct. (2 test cases)

Test #17:

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

input:

2
499
198 243 496 23 384 68 174 76 402 432 291 193 482 264 314 477 383 219 270 197 18 438 409 296 49 282 470 46 38 158 406 204 57 415 5 469 247 126 242 295 372 138 239 186 454 310 447 371 398 274 463 355 229 214 40 480 179 177 19 31 297 381 410 339 226 377 145 71 392 32 6 237 348 466 148 481 309 192...

output:

111122222222222222222222222122222222222222212222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct. (2 test cases)

Test #18:

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

input:

1
389
287 248 46 18 162 190 172 109 183 90 57 353 245 326 378 313 100 24 239 121 219 23 148 64 44 244 74 315 88 175 179 352 169 331 105 125 166 187 39 182 373 231 350 5 171 156 226 135 137 119 206 377 276 117 10 374 357 73 136 356 238 214 50 268 321 235 87 130 153 299 195 177 246 2 360 210 19 228 10...

output:

222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct. (1 test case)

Test #19:

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

input:

1
1000
312 82 696 525 590 249 495 576 257 385 313 290 53 975 823 599 431 113 166 680 929 691 371 544 934 133 675 175 410 56 364 574 909 383 295 618 908 995 306 771 415 317 474 536 807 878 424 271 794 204 533 552 527 834 294 659 391 442 297 976 367 726 780 775 601 437 121 329 589 178 143 704 119 961 ...

output:

222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct. (1 test case)

Test #20:

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

input:

1
1000
364 329 995 901 904 36 794 429 944 755 248 358 29 87 255 223 239 868 96 74 562 903 376 4 474 206 406 565 156 369 195 602 287 208 215 888 712 412 160 513 844 125 346 784 48 280 145 154 664 851 97 458 276 381 798 374 852 871 662 975 890 124 110 332 389 78 591 365 483 898 646 123 229 737 312 922...

output:

122222222222221222122212222122222222222222222222222122222222222222222222222222222212222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct. (1 test case)

Test #21:

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

input:

1
1000
469 637 369 576 724 45 515 610 103 973 309 634 875 667 124 992 601 207 958 261 558 531 305 216 879 974 968 566 243 427 758 749 916 275 349 563 327 131 648 849 65 546 152 902 833 15 320 177 42 226 669 910 418 957 811 657 521 690 987 437 77 656 976 977 718 394 421 824 506 209 134 58 59 630 769 ...

output:

222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct. (1 test case)

Test #22:

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

input:

1
1000
481 866 174 584 599 873 779 718 651 843 662 429 808 139 529 34 367 430 538 108 920 463 423 316 366 527 393 157 52 936 53 611 806 735 120 667 272 246 605 239 273 253 922 640 309 997 477 993 548 643 147 851 687 684 795 765 998 482 934 990 877 729 897 836 150 416 962 854 946 637 661 776 704 526 ...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct. (1 test case)

Extra Test:

score: 0
Extra Test Passed