QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#120168#6301. Minimum Suffixhos_lyricAC ✓412ms61772kbC++145.5kb2023-07-06 14:23:592023-07-06 14:24:00

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-06 14:24:00]
  • 评测
  • 测评结果:AC
  • 用时:412ms
  • 内存:61772kb
  • [2023-07-06 14:23:59]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }


template <class String>
vector<pair<int, int>> lyndonSuffix(const String &as) {
  const int n = as.size();
  vector<pair<int, int>> pqs(n + 1);
  pqs[0] = make_pair(0, 0);
  for (int u = 0; u < n; ) {
    for (int p = 1, q = 1, r = 0, v = u + 1; ; ++v) {
      // as[u, v) = as[u, u + p)^q as[u, u + r)
      // as[u, u + p): Lyndon
      pqs[v] = (r != 0) ? pqs[u + r] : make_pair(p, q);
      if (v == n || as[v - p] > as[v]) {
        u = v - r;
        break;
      } else if (as[v - p] < as[v]) {
        p = v + 1 - u; q = 1; r = 0;
      } else {
        if (++r == p) { ++q; r = 0; }
      }
    }
  }
  return pqs;
}


vector<int> solve(const vector<int> &fs) {
  const int n = (int)fs.size() - 1;
  vector<int> as(n, -1);
  int id = 0;
  vector<int> ids(n, -1), par(n, -1);
  vector<int> vals(n, -1);
  for (int RR = n, R = n, L; R > 0; RR = R, R = L) {
    L = fs[R];
    // as[L, R): Lyndon factor
    {
      const int u = L;
      ids[u] = id++;
      for (int p = 1, q = 1, r = 0, v = u + 1; ; ++v) {
        const int f = v - ((r != 0) ? ((u + r) - fs[u + r]) : p);
        if (fs[v] != f) {
          return {};
        }
        if (v == R) {
          break;
        } else if (fs[v + 1] == u) {
          // as[v - p] < as[v]
          ids[v] = id++;
          par[ids[v]] = ids[v - p];
          p = v + 1 - u; q = 1; r = 0;
        } else {
          // as[v - p] == as[v]
          ids[v] = ids[v - p];
          if (++r == p) { ++q; r = 0; }
        }
      }
    }
    bool large = false;
    int last = -1;
    for (int u = L; u < R; ++u) {
      // correspoinding in next Lyndon factor
      const int tar = (u - L < RR - R) ? as[R + (u - L)] : -1;
      int &val = vals[ids[u]];
      if (!~val) {
        val = 0;
        if (~par[ids[u]]) {
          chmax(val, vals[par[ids[u]]] + 1);
        }
        if (!large) {
          chmax(val, tar);
        }
        last = ids[u];
      }
      if (!large) {
        if (val < tar) {
          ++vals[last];
          large = true;
        } else if (val > tar) {
          large = true;
        }
      }
    }
    if (!large && R - L < RR - R) {
      ++vals[last];
    }
    for (int u = L; u < R; ++u) {
      as[u] = vals[ids[u]];
    }
  }
  return as;
}


void experiment() {
  for (int n = 1; n <= 8; ++n) {
    vector<int> pw(n + 1);
    pw[0] = 1;
    for (int i = 1; i <= n; ++i) pw[i] = pw[i - 1] * n;
    map<vector<int>, vector<int>> app;
    for (int p = 0; p < pw[n]; ++p) {
      vector<int> as(n);
      for (int i = 0; i < n; ++i) {
        as[i] = p / pw[n - 1 - i] % n;
      }
      const auto pqs = lyndonSuffix(as);
      vector<int> fs(n + 1, -1);
      for (int i = 1; i <= n; ++i) {
        fs[i] = i - pqs[i].first;
      }
      if (!app.count(fs)) {
        app[fs] = as;
      }
    }
    int cntLyndon = 0;
    for (const auto &kv : app) {
      // cout << kv.first << " " << kv.second << endl;
      if (kv.first[n] == 0) {
        ++cntLyndon;
      }
    }
    cerr << n << ": " << app.size() << " " << cntLyndon << endl;
    
    vector<int> fac(n + 1);
    fac[0] = 1;
    for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i;
    for (int p = 0; p < fac[n]; ++p) {
      vector<int> fs(n + 1, -1);
      for (int i = 1; i <= n; ++i) {
        fs[i] = p % fac[i] / fac[i - 1];
      }
      vector<int> brt;
      {
        auto it = app.find(fs);
        if (it != app.end()) {
          brt = it->second;
        }
      }
      const auto slv = solve(fs);
      if (brt != slv) {
        cerr << "fs = " << fs << endl;
        cerr << "brt = " << brt << endl;
        cerr << "slv = " << slv << endl;
        assert(false);
      }
    }
  }
}

int main() {
  // experiment(); return 0;
  
  for (int numCases; ~scanf("%d", &numCases); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
    int N;
    scanf("%d", &N);
    vector<int> F(N + 1, -1);
    for (int i = 1; i <= N; ++i) {
      scanf("%d", &F[i]);
      --F[i];
    }
    
    const auto ans = solve(F);
    if (!ans.empty()) {
      for (int i = 0; i < N; ++i) {
        if (i) printf(" ");
        printf("%d", ans[i] + 1);
      }
      puts("");
    } else {
      puts("-1");
    }
  }
#ifndef LOCAL
  break;
#endif
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
3
1 1 1
3
1 1 2
3
1 1 3
3
1 2 1
3
1 2 2
3
1 2 3

output:

1 2 2
-1
1 2 1
1 1 2
2 1 2
1 1 1

result:

ok 16 numbers

Test #2:

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

input:

2
2
1 1
2
1 2

output:

1 2
1 1

result:

ok 4 number(s): "1 2 1 1"

Test #3:

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

input:

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

output:

1 2 2 2
-1
-1
1 2 2 1
-1
-1
-1
-1
1 2 1 3
-1
1 2 1 2
1 2 1 1
1 1 2 2
-1
-1
1 1 2 1
-1
2 1 2 2
-1
2 1 2 1
1 1 1 2
2 1 1 2
2 2 1 2
1 1 1 1

result:

ok 63 numbers

Test #4:

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

input:

120
5
1 1 1 1 1
5
1 1 1 1 2
5
1 1 1 1 3
5
1 1 1 1 4
5
1 1 1 1 5
5
1 1 1 2 1
5
1 1 1 2 2
5
1 1 1 2 3
5
1 1 1 2 4
5
1 1 1 2 5
5
1 1 1 3 1
5
1 1 1 3 2
5
1 1 1 3 3
5
1 1 1 3 4
5
1 1 1 3 5
5
1 1 1 4 1
5
1 1 1 4 2
5
1 1 1 4 3
5
1 1 1 4 4
5
1 1 1 4 5
5
1 1 2 1 1
5
1 1 2 1 2
5
1 1 2 1 3
5
1 1 2 1 4
5
1 1 2 ...

output:

1 2 2 2 2
-1
-1
-1
1 2 2 2 1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1 2 2 1 3
-1
-1
1 2 2 1 2
1 2 2 1 1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1 2 1 3 2
-1
-1
-1
1 2 1 3 1
-1
-1
-1
-1
-1
1 2 1 2 2
-1
1 3 1 2 2
-1
1 2 1 2 1
-1
-1
1 2 1 1 2
2 3 2 1 2
1 2 1 1 1
1 1 2 2 2
-1
-1
-1
1 1 2 2 1
...

result:

ok 256 numbers

Test #5:

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

input:

720
6
1 1 1 1 1 1
6
1 1 1 1 1 2
6
1 1 1 1 1 3
6
1 1 1 1 1 4
6
1 1 1 1 1 5
6
1 1 1 1 1 6
6
1 1 1 1 2 1
6
1 1 1 1 2 2
6
1 1 1 1 2 3
6
1 1 1 1 2 4
6
1 1 1 1 2 5
6
1 1 1 1 2 6
6
1 1 1 1 3 1
6
1 1 1 1 3 2
6
1 1 1 1 3 3
6
1 1 1 1 3 4
6
1 1 1 1 3 5
6
1 1 1 1 3 6
6
1 1 1 1 4 1
6
1 1 1 1 4 2
6
1 1 1 1 4 3
6
...

output:

1 2 2 2 2 2
-1
-1
-1
-1
1 2 2 2 2 1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1 2 2 2 1 3
-1
-1
-1
1 2 2 2 1 2
1 2 2 2 1 1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 1165 numbers

Test #6:

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

input:

5040
7
1 1 1 1 1 1 1
7
1 1 1 1 1 1 2
7
1 1 1 1 1 1 3
7
1 1 1 1 1 1 4
7
1 1 1 1 1 1 5
7
1 1 1 1 1 1 6
7
1 1 1 1 1 1 7
7
1 1 1 1 1 2 1
7
1 1 1 1 1 2 2
7
1 1 1 1 1 2 3
7
1 1 1 1 1 2 4
7
1 1 1 1 1 2 5
7
1 1 1 1 1 2 6
7
1 1 1 1 1 2 7
7
1 1 1 1 1 3 1
7
1 1 1 1 1 3 2
7
1 1 1 1 1 3 3
7
1 1 1 1 1 3 4
7
1 1 1...

output:

1 2 2 2 2 2 2
-1
-1
-1
-1
-1
1 2 2 2 2 2 1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1 2 2 2 2 1 3
-1
-1
-1
-1
1 2 2 2 2 1 2
1 2 2 2 2 1 1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

result:

ok 6438 numbers

Test #7:

score: 0
Accepted
time: 18ms
memory: 3644kb

input:

40320
8
1 1 1 1 1 1 1 1
8
1 1 1 1 1 1 1 2
8
1 1 1 1 1 1 1 3
8
1 1 1 1 1 1 1 4
8
1 1 1 1 1 1 1 5
8
1 1 1 1 1 1 1 6
8
1 1 1 1 1 1 1 7
8
1 1 1 1 1 1 1 8
8
1 1 1 1 1 1 2 1
8
1 1 1 1 1 1 2 2
8
1 1 1 1 1 1 2 3
8
1 1 1 1 1 1 2 4
8
1 1 1 1 1 1 2 5
8
1 1 1 1 1 1 2 6
8
1 1 1 1 1 1 2 7
8
1 1 1 1 1 1 2 8
8
1 1 ...

output:

1 2 2 2 2 2 2 2
-1
-1
-1
-1
-1
-1
1 2 2 2 2 2 2 1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1 2 2 2 2 2 1 3
-1
-1
-1
-1
-1
1 2 2 2 2 2 1 2
1 2 2 2 2 2 1 1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 44590 numbers

Test #8:

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

input:

4862
9
1 2 3 4 5 6 7 8 9
9
1 2 3 4 5 6 7 8 8
9
1 2 3 4 5 6 7 8 7
9
1 2 3 4 5 6 7 8 6
9
1 2 3 4 5 6 7 8 5
9
1 2 3 4 5 6 7 8 4
9
1 2 3 4 5 6 7 8 3
9
1 2 3 4 5 6 7 8 2
9
1 2 3 4 5 6 7 8 1
9
1 2 3 4 5 6 7 7 9
9
1 2 3 4 5 6 7 7 7
9
1 2 3 4 5 6 7 7 6
9
1 2 3 4 5 6 7 7 5
9
1 2 3 4 5 6 7 7 4
9
1 2 3 4 5 6 7...

output:

1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 1 2
2 2 2 2 2 2 1 1 2
2 2 2 2 2 1 1 1 2
2 2 2 2 1 1 1 1 2
2 2 2 1 1 1 1 1 2
2 2 1 1 1 1 1 1 2
2 1 1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 2
2 2 2 2 2 2 1 2 1
2 2 2 2 2 2 1 2 2
-1
-1
-1
-1
-1
-1
2 2 2 2 2 1 1 2 1
2 2 2 2 2 1 1 2 2
-1
-1
-1
-1
-1
2 2 2 2 1 1 1 2 1
2 2 2 2 1 1 1 2...

result:

ok 17638 numbers

Test #9:

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

input:

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

output:

1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 1 2
2 2 2 2 2 2 2 1 1 2
2 2 2 2 2 2 1 1 1 2
2 2 2 2 2 1 1 1 1 2
2 2 2 2 1 1 1 1 1 2
2 2 2 1 1 1 1 1 1 2
2 2 1 1 1 1 1 1 1 2
2 1 1 1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1 2
2 2 2 2 2 2 2 1 2 1
2 2 2 2 2 2 2 1 2 2
-1
-1
-1
-1
-1
-1
-1
2 2 2 2 2 2 1 1 2 1
2 2 2 2 2 2 1 1 2 2...

result:

ok 54425 numbers

Test #10:

score: 0
Accepted
time: 50ms
memory: 3748kb

input:

58786
11
1 2 3 4 5 6 7 8 9 10 11
11
1 2 3 4 5 6 7 8 9 10 10
11
1 2 3 4 5 6 7 8 9 10 9
11
1 2 3 4 5 6 7 8 9 10 8
11
1 2 3 4 5 6 7 8 9 10 7
11
1 2 3 4 5 6 7 8 9 10 6
11
1 2 3 4 5 6 7 8 9 10 5
11
1 2 3 4 5 6 7 8 9 10 4
11
1 2 3 4 5 6 7 8 9 10 3
11
1 2 3 4 5 6 7 8 9 10 2
11
1 2 3 4 5 6 7 8 9 10 1
11
1 2...

output:

1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 1 2
2 2 2 2 2 2 2 2 1 1 2
2 2 2 2 2 2 2 1 1 1 2
2 2 2 2 2 2 1 1 1 1 2
2 2 2 2 2 1 1 1 1 1 2
2 2 2 2 1 1 1 1 1 1 2
2 2 2 1 1 1 1 1 1 1 2
2 2 1 1 1 1 1 1 1 1 2
2 1 1 1 1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1 1 2
2 2 2 2 2 2 2 2 1 2 1
2 2 2 2 2 2 2 2 1 2 2
-1
-1
-1
-1
-1...

result:

ok 168246 numbers

Test #11:

score: 0
Accepted
time: 79ms
memory: 3664kb

input:

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

output:

1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 1 2
2 2 2 2 2 2 2 2 2 1 1 2
2 2 2 2 2 2 2 2 1 1 1 2
2 2 2 2 2 2 2 1 1 1 1 2
2 2 2 2 2 2 1 1 1 1 1 2
2 2 2 2 2 1 1 1 1 1 1 2
2 2 2 2 1 1 1 1 1 1 1 2
2 2 2 1 1 1 1 1 1 1 1 2
2 2 1 1 1 1 1 1 1 1 1 2
2 1 1 1 1 1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1 1 1 2
2 2 2 2 2 2 ...

result:

ok 211133 numbers

Test #12:

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

input:

100000
12
1 2 2 4 5 5 2 8 1 1 11 11
12
1 2 2 4 5 5 2 8 1 1 11 1
12
1 2 2 4 5 5 2 8 1 1 1 12
12
1 2 2 4 5 5 2 8 1 1 1 1
12
1 2 2 4 5 5 2 2 9 10 11 12
12
1 2 2 4 5 5 2 2 9 10 11 11
12
1 2 2 4 5 5 2 2 9 10 11 10
12
1 2 2 4 5 5 2 2 9 10 11 9
12
1 2 2 4 5 5 2 2 9 10 11 2
12
1 2 2 4 5 5 2 2 9 10 11 1
12
1...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 272700 numbers

Test #13:

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

input:

8012
12
1 1 1 4 4 6 4 8 4 4 11 4
12
1 1 1 4 4 6 4 8 4 4 11 1
12
1 1 1 4 4 6 4 8 4 4 4 12
12
1 1 1 4 4 6 4 8 4 4 4 4
12
1 1 1 4 4 6 4 8 4 4 4 1
12
1 1 1 4 4 6 4 8 4 4 1 12
12
1 1 1 4 4 6 4 8 4 4 1 1
12
1 1 1 4 4 6 4 8 4 1 11 12
12
1 1 1 4 4 6 4 8 4 1 11 11
12
1 1 1 4 4 6 4 8 4 1 11 1
12
1 1 1 4 4 6 4...

output:

1 2 2 1 2 1 3 1 3 2 1 3
-1
1 2 2 1 2 1 3 1 3 2 2 1
1 2 2 1 2 1 3 1 3 2 2 2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1 2 2 1 2 1 3 2 1 1 1 1
2 3 3 2 3 2 4 3 2 2 1 2
2 3 3 2 3 2 4 3 2 1 1 2
1 2 2 1 2 1 3 2 1 1 1 2
-1
-1
2 3 3 2 3 2 4 3 2 1 2 1
2 3 3 2 3 2 4 3 2 1 2 2
-1
-1
-1
...

result:

ok 39406 numbers

Test #14:

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

input:

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

output:

1 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 1 2
2 2 2 2 2 2 2 2 2 2 1 1 2
2 2 2 2 2 2 2 2 2 1 1 1 2
2 2 2 2 2 2 2 2 1 1 1 1 2
2 2 2 2 2 2 2 1 1 1 1 1 2
2 2 2 2 2 2 1 1 1 1 1 1 2
2 2 2 2 2 1 1 1 1 1 1 1 2
2 2 2 2 1 1 1 1 1 1 1 1 2
2 2 2 1 1 1 1 1 1 1 1 1 2
2 2 1 1 1 1 1 1 1 1 1 1 2
2 1 1 1 1 1 1 ...

result:

ok 173800 numbers

Test #15:

score: 0
Accepted
time: 77ms
memory: 3664kb

input:

100000
13
1 2 3 4 4 6 6 6 9 9 11 3 1
13
1 2 3 4 4 6 6 6 9 9 11 2 13
13
1 2 3 4 4 6 6 6 9 9 11 2 2
13
1 2 3 4 4 6 6 6 9 9 11 2 1
13
1 2 3 4 4 6 6 6 9 9 11 1 13
13
1 2 3 4 4 6 6 6 9 9 11 1 1
13
1 2 3 4 4 6 6 6 9 9 9 12 13
13
1 2 3 4 4 6 6 6 9 9 9 12 12
13
1 2 3 4 4 6 6 6 9 9 9 12 9
13
1 2 3 4 4 6 6 6 ...

output:

-1
-1
-1
-1
-1
-1
2 2 2 1 3 1 2 2 1 2 2 1 1
2 2 2 1 3 1 2 2 1 2 2 1 2
2 2 2 1 3 1 2 3 1 2 2 1 3
2 2 2 1 3 1 2 2 1 2 2 1 3
-1
-1
-1
-1
2 2 2 1 3 1 2 3 1 2 2 2 1
2 2 2 1 3 1 2 3 1 2 2 2 2
-1
-1
-1
-1
-1
2 2 2 1 3 1 2 2 1 2 2 2 1
2 2 2 1 3 1 2 2 1 2 2 2 2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

result:

ok 181240 numbers

Test #16:

score: 0
Accepted
time: 75ms
memory: 3664kb

input:

100000
13
1 2 3 3 5 6 2 8 2 1 11 1 1
13
1 2 3 3 5 6 2 8 2 1 1 12 13
13
1 2 3 3 5 6 2 8 2 1 1 12 12
13
1 2 3 3 5 6 2 8 2 1 1 12 1
13
1 2 3 3 5 6 2 8 2 1 1 1 13
13
1 2 3 3 5 6 2 8 2 1 1 1 1
13
1 2 3 3 5 6 2 8 1 10 11 12 13
13
1 2 3 3 5 6 2 8 1 10 11 12 12
13
1 2 3 3 5 6 2 8 1 10 11 12 11
13
1 2 3 3 5 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 181180 numbers

Test #17:

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

input:

100000
13
1 2 3 2 2 6 1 8 9 10 1 1 13
13
1 2 3 2 2 6 1 8 9 10 1 1 1
13
1 2 3 2 2 6 1 8 9 9 11 12 13
13
1 2 3 2 2 6 1 8 9 9 11 12 12
13
1 2 3 2 2 6 1 8 9 9 11 12 11
13
1 2 3 2 2 6 1 8 9 9 11 12 9
13
1 2 3 2 2 6 1 8 9 9 11 12 8
13
1 2 3 2 2 6 1 8 9 9 11 12 1
13
1 2 3 2 2 6 1 8 9 9 11 11 13
13
1 2 3 2 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 219508 numbers

Test #18:

score: 0
Accepted
time: 84ms
memory: 3664kb

input:

100000
13
1 2 2 4 4 1 7 1 9 10 9 1 13
13
1 2 2 4 4 1 7 1 9 10 9 1 1
13
1 2 2 4 4 1 7 1 9 10 1 12 13
13
1 2 2 4 4 1 7 1 9 10 1 12 12
13
1 2 2 4 4 1 7 1 9 10 1 12 1
13
1 2 2 4 4 1 7 1 9 10 1 1 13
13
1 2 2 4 4 1 7 1 9 10 1 1 1
13
1 2 2 4 4 1 7 1 9 9 11 12 13
13
1 2 2 4 4 1 7 1 9 9 11 12 12
13
1 2 2 4 4...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 205408 numbers

Test #19:

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

input:

100000
13
1 2 1 4 5 1 7 8 9 9 11 7 1
13
1 2 1 4 5 1 7 8 9 9 11 1 13
13
1 2 1 4 5 1 7 8 9 9 11 1 1
13
1 2 1 4 5 1 7 8 9 9 9 12 13
13
1 2 1 4 5 1 7 8 9 9 9 12 12
13
1 2 1 4 5 1 7 8 9 9 9 12 9
13
1 2 1 4 5 1 7 8 9 9 9 12 8
13
1 2 1 4 5 1 7 8 9 9 9 12 7
13
1 2 1 4 5 1 7 8 9 9 9 12 1
13
1 2 1 4 5 1 7 8 9...

output:

-1
-1
-1
2 2 3 2 2 4 2 2 1 2 2 1 1
2 2 3 2 2 4 2 2 1 2 2 1 2
2 2 3 2 2 4 2 2 1 2 2 1 3
-1
-1
-1
2 2 3 2 2 4 2 2 1 2 2 2 1
2 2 3 2 2 4 2 2 1 2 2 2 2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2 2 3 2 2 4 2 1 1 2 1 1 1
3 3 4 ...

result:

ok 254500 numbers

Test #20:

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

input:

100000
13
1 1 3 4 4 4 7 3 3 10 10 10 10
13
1 1 3 4 4 4 7 3 3 10 10 10 3
13
1 1 3 4 4 4 7 3 3 10 10 10 1
13
1 1 3 4 4 4 7 3 3 10 10 3 13
13
1 1 3 4 4 4 7 3 3 10 10 3 3
13
1 1 3 4 4 4 7 3 3 10 10 3 1
13
1 1 3 4 4 4 7 3 3 10 10 1 13
13
1 1 3 4 4 4 7 3 3 10 10 1 1
13
1 1 3 4 4 4 7 3 3 10 3 12 13
13
1 1 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 273136 numbers

Test #21:

score: 0
Accepted
time: 37ms
memory: 3652kb

input:

42900
13
1 1 1 4 5 5 7 7 1 1 11 12 12
13
1 1 1 4 5 5 7 7 1 1 11 12 11
13
1 1 1 4 5 5 7 7 1 1 11 12 1
13
1 1 1 4 5 5 7 7 1 1 11 11 13
13
1 1 1 4 5 5 7 7 1 1 11 11 11
13
1 1 1 4 5 5 7 7 1 1 11 11 1
13
1 1 1 4 5 5 7 7 1 1 11 1 13
13
1 1 1 4 5 5 7 7 1 1 11 1 1
13
1 1 1 4 5 5 7 7 1 1 1 12 13
13
1 1 1 4 5...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2 3 3 2 1 2 1 3 1 1 1 1 1
3 4 4 3 2 3 2 4 2 2 2 1 2
3 4 4 3 2 3 2 4 2 2 1 1 2
3 4 4 3 2 3 2 4 2 1 1 1 2
2 3 3 2 1 2 1 3 1 1 1 1 2
-1
-1
-1
3 4 4 3 2 3 2 4 2 2 1 2 1
3 4 4 3 2 3 2 4 2 2 1 2 2
-1
-1
-1
-1
-1
3 4 4 3 2 3 2 4 2 1 1 2 1
3 4 4 3 2 3 2 4 2 1 1 2 2
-1
...

result:

ok 154428 numbers

Test #22:

score: 0
Accepted
time: 125ms
memory: 3652kb

input:

66666
15
1 2 3 1 1 6 7 8 9 10 6 12 13 6 15
15
1 1 3 4 5 6 7 8 3 10 3 12 3 3 15
15
1 1 3 3 5 5 1 8 9 8 11 12 13 14 15
15
1 2 1 1 1 1 7 8 7 7 11 12 13 14 11
15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
15
1 1 1 4 5 4 4 8 4 10 4 12 13 12 15
15
1 2 3 3 5 5 3 8 9 10 11 8 13 14 15
15
1 2 3 2 2 6 7 8 9 6 6 12 13...

output:

1 1 1 2 2 1 1 1 1 1 2 1 1 2 1
1 2 1 1 1 1 1 1 2 1 2 1 2 2 1
1 2 1 2 1 2 2 1 1 2 1 1 1 1 1
1 1 2 2 2 2 1 1 2 2 1 1 1 1 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 2 2 1 1 2 2 1 2 1 2 1 1 2 1
2 2 1 2 1 2 2 1 1 1 1 2 1 1 1
2 1 1 2 2 1 1 1 1 2 2 1 1 1 2
1 2 1 2 2 1 2 2 2 1 1 2 2 1 2
2 1 1 1 1 2 2 1 1 1 1 2 1 2 2
...

result:

ok 999990 numbers

Test #23:

score: 0
Accepted
time: 126ms
memory: 3664kb

input:

66666
15
1 1 1 4 5 4 4 8 4 4 11 4 4 4 4
15
1 2 3 4 5 6 1 8 9 10 11 12 11 11 15
15
1 1 3 4 5 3 7 8 3 10 11 3 3 3 3
15
1 2 3 2 2 2 7 2 2 2 2 2 2 2 2
15
1 2 2 2 2 6 6 6 9 10 9 12 13 14 12
15
1 1 1 4 4 1 1 1 1 10 11 10 10 10 15
15
1 2 3 4 4 4 4 4 4 10 10 10 10 14 14
15
1 2 2 2 2 2 7 8 7 7 7 7 7 7 7
15
1...

output:

1 2 2 1 1 2 2 1 2 2 1 2 2 2 2
2 2 2 2 2 2 3 2 2 2 1 1 2 2 1
1 2 1 1 1 2 1 1 2 1 1 2 2 2 2
2 1 1 2 2 2 1 2 2 2 2 2 2 2 2
2 1 2 2 2 1 2 2 1 1 2 1 1 1 2
1 2 2 1 2 3 2 2 2 1 1 2 2 2 1
2 2 2 1 2 2 2 2 2 1 2 2 2 1 2
2 1 2 2 2 2 1 1 2 2 2 2 2 2 2
1 1 2 2 1 2 2 2 2 2 1 1 1 2 2
1 1 1 2 1 2 1 2 2 2 1 2 2 2 2
...

result:

ok 999990 numbers

Test #24:

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

input:

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

output:

1 1 1 1 1 2 1 2 1 1 1 2 2 1 1 1
2 1 2 1 2 2 1 2 2 2 1 2 2 1 1 1
2 1 2 1 2 2 1 1 2 1 1 1 2 2 2 1
1 1 1 1 2 1 2 2 1 1 1 1 1 1 1 2
1 2 2 2 1 2 2 1 2 1 1 1 2 2 1 2
1 1 2 1 2 2 1 2 1 1 1 2 1 2 2 2
1 1 1 2 1 1 2 1 1 2 2 1 2 2 2 1
2 2 1 2 2 2 2 2 2 1 1 2 1 2 1 2
1 2 2 1 2 2 1 1 2 2 1 2 1 1 1 1
1 1 1 2 1 1 ...

result:

ok 1000000 numbers

Test #25:

score: 0
Accepted
time: 121ms
memory: 3748kb

input:

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

output:

2 2 1 2 2 1 1 2 2 2 1 2 2 1 2 2
1 2 2 1 1 2 1 2 2 2 1 1 2 2 1 2
2 2 1 1 1 1 2 2 2 1 2 1 2 1 2 1
1 2 2 1 1 2 1 1 2 1 1 1 2 1 2 1
2 2 2 2 2 1 2 1 2 2 2 1 3 2 2 1
2 2 2 2 1 1 2 2 1 2 2 2 2 2 2 2
2 1 2 2 2 1 2 2 3 2 2 1 1 1 1 1
2 1 1 1 2 2 2 2 2 1 2 1 2 2 1 1
2 2 2 2 2 3 3 1 2 1 1 2 1 1 1 2
2 1 2 2 2 2 ...

result:

ok 1000000 numbers

Test #26:

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

input:

58823
17
1 2 3 4 5 3 3 3 3 10 3 3 13 3 15 3 3
17
1 2 3 2 2 6 2 2 2 2 11 2 2 2 15 16 15
17
1 2 1 1 5 6 5 5 1 10 11 12 10 10 10 10 17
17
1 2 3 2 2 2 2 2 9 2 2 2 13 14 15 16 13
17
1 2 3 2 5 6 5 2 9 2 2 2 2 14 15 14 17
17
1 1 1 4 4 4 7 7 7 1 1 12 12 12 1 16 17
17
1 2 1 1 1 6 7 6 6 10 6 6 6 14 6 6 6
17
1...

output:

2 2 1 1 1 2 2 2 2 1 2 2 1 2 1 2 2
2 1 1 2 2 1 2 2 2 2 1 2 2 2 1 1 2
1 1 2 2 1 1 2 2 2 1 1 1 2 2 2 2 1
2 1 1 2 2 2 2 2 1 2 2 2 1 1 1 1 2
2 1 1 2 1 1 2 2 1 2 2 2 2 1 1 2 1
1 2 2 1 2 2 1 2 2 2 2 1 2 2 2 1 1
1 1 2 2 2 1 1 2 2 1 2 2 2 1 2 2 2
1 2 2 1 1 2 1 2 1 1 2 2 1 1 1 1 1
1 1 1 2 1 1 2 2 2 1 1 1 2 2 ...

result:

ok 999991 numbers

Test #27:

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

input:

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

output:

2 1 1 1 2 2 1 2 2 1 2 2 2 1 1 2 1
2 2 1 2 2 2 2 1 1 1 2 1 2 2 2 2 2
1 1 2 3 1 1 2 2 2 2 1 2 1 2 2 2 2
2 1 2 1 2 2 2 2 2 2 2 1 2 1 1 1 2
2 2 1 1 2 1 1 1 1 2 2 1 2 2 2 2 2
2 3 2 2 1 2 1 2 2 1 2 1 1 2 2 2 2
2 1 2 1 2 2 2 2 1 1 1 2 2 2 2 1 2
2 2 2 1 1 2 2 2 2 1 1 2 2 1 2 2 2
1 1 1 3 1 1 1 2 2 1 1 2 2 2 ...

result:

ok 999991 numbers

Test #28:

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

input:

58823
17
1 2 3 2 2 2 2 2 2 2 2 12 2 14 2 2 17
17
1 2 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1
17
1 1 1 4 1 1 1 8 1 1 1 1 1 1 1 1 1
17
1 2 3 3 3 3 3 3 9 10 9 9 13 9 9 9 9
17
1 1 3 3 3 3 3 3 9 9 9 12 13 12 12 12 17
17
1 2 3 3 3 3 3 3 3 3 11 11 11 3 15 15 17
17
1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 16 16
17
1 2 3 3 3 3 ...

output:

2 1 1 2 2 2 2 2 2 2 2 1 2 1 2 2 1
1 1 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2
1 2 2 1 3 2 2 1 3 2 2 2 2 2 2 2 2
2 2 1 2 2 2 2 2 1 1 2 2 1 2 2 2 2
1 3 1 2 2 2 2 2 1 2 2 1 1 2 2 2 1
2 2 1 2 2 2 2 2 2 2 1 2 2 3 1 2 1
2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2
2 2 1 2 2 2 2 3 1 2 2 2 2 2 2 2 2
1 2 2 2 1 3 2 1 1 2 2 2 2 2 ...

result:

ok 999991 numbers

Test #29:

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

input:

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

output:

1 2 2 2 2 1 1 1 1 2 1 2 2 1 2 2 2 2
2 1 2 1 1 1 1 2 1 2 1 2 2 2 2 2 2 2
1 1 2 2 1 1 1 2 2 2 1 1 1 2 2 1 2 2
2 2 2 2 1 2 1 1 1 1 1 2 1 2 2 2 2 2
1 1 1 2 1 2 2 1 2 1 1 2 1 1 1 2 2 2
1 1 1 2 1 2 2 2 2 1 2 1 2 1 1 2 1 1
1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1
1 1 1 2 1 1 1 2 2 2 1 1 1 1 2 2 1 2
1 2 2 1 1 1 ...

result:

ok 999990 numbers

Test #30:

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

input:

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

output:

2 3 3 2 2 3 2 1 2 2 1 3 1 1 2 2 2 2
1 2 1 2 1 1 2 2 2 2 2 2 2 2 1 1 1 2
1 2 2 1 1 1 3 1 1 1 2 1 1 2 2 2 2 2
2 1 1 1 2 2 1 2 2 1 1 2 2 2 1 2 1 1
2 1 1 2 2 2 1 1 3 1 1 2 2 3 2 2 1 1
2 2 1 1 1 2 1 1 1 3 1 2 2 2 2 2 1 2
1 1 2 1 2 2 1 2 2 2 2 2 2 1 2 2 2 2
2 1 3 1 2 2 2 1 2 2 2 1 1 2 1 2 2 2
1 1 2 2 2 2 ...

result:

ok 999990 numbers

Test #31:

score: 0
Accepted
time: 129ms
memory: 3652kb

input:

55555
18
1 1 1 4 4 6 7 6 6 6 6 6 13 6 15 6 17 6
18
1 2 2 2 2 2 7 7 9 7 7 12 12 7 15 16 15 15
18
1 2 2 2 5 5 5 5 5 10 10 12 10 14 15 14 14 14
18
1 2 2 2 5 5 5 5 5 5 5 5 5 14 14 14 14 18
18
1 1 1 1 5 5 5 5 5 5 5 5 13 5 15 5 17 5
18
1 1 3 3 1 1 1 8 8 1 1 12 1 1 1 1 1 1
18
1 1 3 4 4 4 7 7 4 4 4 4 4 4 4 ...

output:

1 2 2 1 2 1 1 2 2 2 2 2 1 2 1 2 1 2
2 1 2 2 2 2 1 2 1 3 2 1 2 2 1 1 2 2
2 1 2 3 1 2 2 2 2 1 2 1 3 1 1 2 2 2
2 1 2 3 1 2 2 2 2 2 2 2 2 1 2 2 2 1
1 2 2 3 1 2 2 2 2 2 2 2 1 3 1 3 1 3
1 2 1 2 2 2 2 1 2 2 2 1 3 2 2 2 2 2
2 3 2 1 2 2 1 2 3 2 2 2 2 2 2 2 2 2
3 2 3 3 3 2 1 1 2 2 2 2 2 2 2 2 1 2
2 2 1 2 2 2 ...

result:

ok 999990 numbers

Test #32:

score: 0
Accepted
time: 118ms
memory: 3664kb

input:

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

output:

2 2 2 2 1 2 1 2 1 2 2 1 1 2 2 2 1 1 2
1 1 1 2 1 1 2 1 2 1 1 1 2 1 1 2 1 1 2
2 1 2 1 1 2 1 1 1 1 2 1 1 2 2 2 2 2 1
1 1 2 2 1 2 2 2 2 2 2 1 1 1 2 2 1 1 2
1 2 1 2 1 2 2 1 2 1 2 1 2 2 1 2 1 2 2
2 2 2 2 1 2 2 2 1 2 2 2 1 1 1 1 2 1 2
1 2 2 2 1 1 1 2 1 2 1 2 1 1 1 2 1 1 1
2 2 1 2 2 2 1 2 1 1 1 2 2 1 2 2 1 ...

result:

ok 999989 numbers

Test #33:

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

input:

52631
19
1 2 3 3 3 3 3 3 3 10 10 12 12 12 12 12 12 18 19
19
1 2 3 1 5 1 1 1 1 10 1 12 13 1 15 1 1 18 1
19
1 2 3 4 2 2 7 2 9 2 2 2 13 14 2 16 2 2 19
19
1 2 2 4 5 6 4 4 9 10 4 4 4 4 15 4 4 4 4
19
1 2 3 1 1 6 1 1 1 1 11 12 13 11 15 11 11 11 11
19
1 1 1 4 4 4 4 4 4 4 4 4 4 4 4 4 17 18 17
19
1 2 1 1 5 6 ...

output:

2 2 1 3 2 2 2 2 2 1 3 1 2 2 2 2 2 1 1
1 1 1 2 1 2 2 2 2 1 2 1 1 2 1 2 2 1 2
2 1 1 1 2 2 1 2 1 2 2 2 1 1 2 1 2 2 1
2 1 2 1 1 1 2 2 1 1 2 2 2 2 1 2 2 2 2
1 1 1 2 2 1 2 2 2 2 1 1 1 2 1 2 2 2 2
1 2 3 1 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2
1 1 2 2 1 1 1 2 1 2 2 1 2 2 2 1 2 2 2
1 1 2 2 2 3 1 1 2 2 2 2 1 2 2 1 1 ...

result:

ok 999989 numbers

Test #34:

score: 0
Accepted
time: 118ms
memory: 3748kb

input:

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

output:

2 1 1 1 2 1 2 2 2 1 1 2 2 2 2 2 2 2 2
2 1 3 2 2 1 3 1 2 2 2 2 1 3 2 2 2 2 2
1 2 2 2 2 1 2 2 3 1 2 2 2 1 1 2 2 2 2
2 1 2 2 2 2 2 2 1 2 2 1 1 2 1 2 2 2 2
1 2 2 2 2 2 1 1 2 2 2 2 1 2 2 1 2 2 1
1 2 2 2 1 2 1 2 1 1 2 2 2 2 2 2 2 2 1
1 2 2 2 2 2 2 2 2 2 1 1 2 2 1 2 2 2 2
2 2 3 3 1 3 1 3 2 1 2 2 2 2 2 2 2 ...

result:

ok 999989 numbers

Test #35:

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

input:

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

output:

1 2 1 2 1 1 1 2 1 1 1 2 1 1 2 1 1 1 2 2
1 1 2 1 2 1 1 1 2 1 2 1 1 1 2 2 1 2 1 2
1 1 1 2 2 1 2 2 1 2 2 2 2 2 2 1 1 1 1 2
2 1 1 1 1 2 2 2 2 1 2 1 2 2 2 1 2 2 2 1
1 2 1 2 2 2 1 2 1 1 1 2 2 2 1 2 1 2 1 1
1 1 1 2 2 2 1 1 1 1 2 2 2 1 1 1 2 1 1 1
1 2 1 1 1 2 2 1 1 2 1 1 2 1 2 1 1 1 2 2
1 1 1 1 1 1 2 2 1 1 ...

result:

ok 1000000 numbers

Test #36:

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

input:

50000
20
1 2 3 4 5 3 3 3 3 3 11 12 3 3 3 3 3 3 3 3
20
1 2 3 3 5 5 7 8 7 10 7 7 7 14 15 14 7 7 7 20
20
1 2 1 1 5 6 5 8 5 10 5 5 5 5 5 5 5 18 19 5
20
1 2 3 2 5 2 7 8 7 10 11 7 7 14 7 7 7 7 19 7
20
1 2 2 2 2 2 7 7 9 9 7 7 7 7 15 7 7 7 7 7
20
1 2 3 4 5 2 2 2 2 2 2 12 2 2 15 2 2 2 2 2
20
1 2 3 4 3 3 3 3 ...

output:

2 2 1 1 1 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2
2 2 1 2 1 2 1 1 2 1 2 2 2 1 1 2 2 2 2 1
1 1 2 2 1 1 2 1 2 1 2 2 2 2 2 2 2 1 1 3
2 1 1 2 1 2 1 1 2 1 1 3 2 1 2 2 2 2 1 2
2 1 2 2 2 2 1 2 1 2 2 2 2 2 1 3 2 2 2 2
2 1 1 1 1 2 2 2 2 2 2 1 2 2 1 2 2 2 2 2
2 2 1 1 2 2 2 2 2 1 1 2 2 1 1 3 1 2 2 1
2 2 1 2 1 1 2 2 2 2 ...

result:

ok 1000000 numbers

Test #37:

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

input:

50000
20
1 2 3 4 5 5 5 5 5 5 11 12 13 11 11 16 17 18 18 18
20
1 2 2 2 5 6 7 8 6 6 11 12 13 11 6 6 17 6 6 20
20
1 1 1 4 4 6 7 6 9 10 9 6 13 6 6 6 17 6 6 6
20
1 1 3 4 4 4 7 7 4 4 11 12 11 11 15 11 11 11 11 20
20
1 1 3 3 3 6 7 6 6 6 11 12 13 11 11 11 17 11 11 20
20
1 2 3 2 2 2 2 2 2 10 2 2 2 14 2 16 2 ...

output:

3 3 3 3 2 3 3 3 3 3 2 2 2 3 3 2 2 1 2 2
3 2 3 3 2 1 1 1 2 2 1 1 1 2 3 2 1 2 2 1
1 2 2 1 2 1 1 2 1 1 2 2 1 2 2 2 1 2 2 2
2 3 2 1 2 2 1 2 3 2 1 1 2 2 1 2 2 2 2 1
1 3 1 2 2 1 1 2 2 2 1 1 1 2 2 2 1 2 2 1
2 1 1 2 2 2 2 2 2 1 2 2 2 1 2 1 2 2 2 2
2 1 2 2 2 2 2 2 2 2 1 1 2 1 2 2 1 2 2 2
2 1 1 1 2 2 1 2 1 2 ...

result:

ok 1000000 numbers

Test #38:

score: 0
Accepted
time: 106ms
memory: 3664kb

input:

50000
20
1 2 3 4 4 4 4 4 4 10 10 10 13 10 10 10 10 10 10 10
20
1 1 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
20
1 1 1 1 5 6 5 8 9 9 9 9 9 9 9 16 17 16 16 16
20
1 1 3 3 3 3 3 3 3 10 3 3 3 14 3 3 3 3 3 3
20
1 2 3 4 5 6 7 8 6 6 11 6 6 14 6 6 6 6 19 6
20
1 2 2 4 4 4 4 8 9 8 8 8 8 8 8 16 8 8 8 8
20
1 1 1 4 5 4...

output:

2 2 2 1 2 2 2 2 2 1 2 2 1 3 2 2 2 2 2 2
2 3 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 3 3 3 2 2 3 2 1 2 2 2 2 2 2 1 1 2 2 2
1 3 1 2 2 2 2 2 2 1 3 2 2 1 3 2 2 2 2 2
2 2 2 2 2 1 1 1 2 2 1 2 2 1 2 2 2 2 1 2
2 1 3 1 2 2 2 1 1 2 2 2 2 2 2 1 2 2 2 2
1 2 2 1 1 2 2 2 2 2 2 1 2 2 1 1 1 2 1 2
2 2 2 3 2 1 2 2 2 2 ...

result:

ok 1000000 numbers

Test #39:

score: 0
Accepted
time: 350ms
memory: 41720kb

input:

6414
137
1 2 1 1 1 1 1 1 1 1 1 1 1 14 15 14 14 14 14 14 14 14 14 14 14 14 27 28 27 27 27 27 27 27 27 27 27 27 27 40 41 40 40 40 40 40 40 40 40 40 40 40 53 54 53 53 53 53 53 53 53 53 53 53 53 66 67 68 66 66 71 66 66 74 66 66 77 66 79 80 81 82 80 80 85 80 87 88 89 87 87 92 87 94 95 94 94 94 94 94 101 ...

output:

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

result:

ok 3000000 numbers

Test #40:

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

input:

19787
93
1 1 1 4 4 6 4 4 9 10 9 9 9 9 9 9 17 18 17 17 17 17 23 17 25 26 25 25 25 25 31 25 33 34 33 33 33 33 39 33 41 42 43 44 45 46 47 48 49 50 51 52 53 54 54 56 56 54 59 59 61 61 59 64 64 66 66 64 69 69 71 71 73 74 73 76 76 76 76 76 76 76 83 83 85 86 87 85 89 90 89 92 93
5
1 1 1 4 4
52
1 1 3 3 5 5 ...

output:

4 5 5 4 5 4 6 5 4 4 5 5 5 5 5 5 4 4 5 5 5 5 4 5 4 4 5 5 5 5 4 5 4 4 5 5 5 5 4 5 4 4 4 4 4 4 4 4 4 4 4 4 4 3 4 3 4 4 3 4 3 4 4 3 4 3 4 4 3 4 3 4 3 3 4 2 3 3 3 3 3 3 2 3 2 2 2 3 1 1 2 1 1
1 2 2 1 2
2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 2 1 3 1 3 1 3 1 3 1 3 1 2 2 2 2 1 2 2 2 2 1 2 2 2 2 1 2 2 2 2 1 2 2 2 2 1
...

result:

ok 3000000 numbers

Test #41:

score: 0
Accepted
time: 352ms
memory: 49808kb

input:

3279
174
1 2 1 4 1 1 7 1 1 10 1 12 13 12 15 12 17 12 19 12 12 12 23 24 23 26 23 28 23 30 23 23 23 34 35 34 37 34 39 34 41 34 34 34 45 46 45 48 45 50 45 52 45 45 45 56 57 56 59 56 61 56 63 56 56 56 67 68 67 70 67 72 67 74 67 67 67 78 79 78 81 78 78 78 78 78 78 78 78 90 90 90 90 90 90 90 90 98 98 100 ...

output:

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

result:

ok 3000000 numbers

Test #42:

score: 0
Accepted
time: 377ms
memory: 46460kb

input:

1806
66
1 1 1 1 1 6 6 6 6 6 11 11 11 11 11 16 17 18 16 16 21 22 23 21 21 26 26 26 26 30 26 26 26 26 26 26 26 26 26 26 26 26 43 43 43 43 47 43 43 43 43 43 43 43 43 43 43 43 43 60 61 60 63 60 65 65
161
1 2 1 1 1 6 1 8 9 1 1 1 1 1 15 1 1 1 19 20 19 19 19 24 19 26 27 19 19 19 19 19 33 19 19 19 37 38 37 ...

output:

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

result:

ok 3000000 numbers

Test #43:

score: 0
Accepted
time: 350ms
memory: 48768kb

input:

1514
77
1 1 1 4 4 4 1 8 1 10 10 10 13 13 13 10 17 10 19 19 19 19 23 19 19 19 19 19 19 19 19 19 33 33 33 33 37 33 33 33 33 33 33 33 33 33 47 47 49 49 47 47 47 47 47 47 47 47 47 60 60 62 60 60 60 60 67 60 60 60 60 60 60 74 74 60 77
223
1 1 1 1 1 1 1 1 1 10 1 12 1 1 1 16 17 16 16 16 16 16 16 16 16 16 1...

output:

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

result:

ok 3000000 numbers

Test #44:

score: 0
Accepted
time: 375ms
memory: 36512kb

input:

6166
201
1 2 3 1 1 1 7 7 9 9 11 11 13 13 9 9 17 17 19 19 21 21 23 23 19 19 27 28 27 27 31 27 27 27 35 27 37 38 37 37 37 37 43 37 37 37 37 37 49 50 49 49 49 49 55 49 49 49 49 49 61 62 63 61 61 61 61 68 61 61 61 61 61 61 75 76 77 75 75 75 75 82 75 75 75 75 75 75 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

4 4 4 5 5 5 3 6 3 5 3 5 3 5 4 4 3 5 3 4 3 4 3 4 4 4 3 3 4 5 3 4 4 4 3 4 3 3 4 4 4 4 3 4 4 4 4 4 3 3 4 4 4 4 3 4 4 4 4 4 3 3 3 4 4 4 4 3 4 4 4 4 4 4 3 3 3 4 4 4 4 3 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 2 4 2 4 2 4 2 4 2 4 2 3 2 4 3 3 2 4 3 2 3 3 3 3 3 3 2 4 3 3 2 3 2 4 3 3 2 4 3 2 3 3 3 3 3 3 2 4 3 3 ...

result:

ok 3000000 numbers

Test #45:

score: 0
Accepted
time: 370ms
memory: 41912kb

input:

3578
291
1 1 1 1 1 1 1 8 1 1 1 1 1 1 1 16 1 1 1 1 21 21 21 21 21 21 21 28 21 21 21 21 21 21 21 36 21 21 21 21 41 41 41 41 41 41 41 48 41 41 41 41 41 41 41 56 41 41 41 41 61 61 61 61 61 61 61 68 61 61 61 61 61 61 61 76 61 61 61 61 81 81 81 81 81 81 81 88 81 81 81 81 81 81 81 96 81 81 81 81 101 101 10...

output:

3 4 4 4 4 4 4 3 5 4 4 4 4 4 4 3 5 4 4 4 3 4 4 4 4 4 4 3 5 4 4 4 4 4 4 3 5 4 4 4 3 4 4 4 4 4 4 3 5 4 4 4 4 4 4 3 5 4 4 4 3 4 4 4 4 4 4 3 5 4 4 4 4 4 4 3 5 4 4 4 3 4 4 4 4 4 4 3 5 4 4 4 4 4 4 3 5 4 4 4 3 4 4 4 4 4 4 3 5 4 4 4 4 4 4 3 5 4 4 4 3 3 4 5 3 3 4 6 3 4 3 4 3 4 4 4 3 4 4 4 3 3 4 4 4 3 3 4 4 4 ...

result:

ok 3000000 numbers

Test #46:

score: 0
Accepted
time: 347ms
memory: 27580kb

input:

7672
152
1 2 1 1 5 1 1 1 9 1 1 1 1 1 1 16 1 1 19 1 21 1 1 1 1 1 1 28 28 28 28 28 28 34 28 28 37 28 28 28 28 28 28 44 45 44 44 44 49 44 44 52 53 52 44 56 44 44 59 44 61 44 44 64 65 64 64 64 69 64 64 72 73 72 64 76 64 64 79 64 81 64 64 84 85 86 84 88 84 90 84 84 84 84 84 84 97 84 84 100 84 102 84 104 ...

output:

3 3 4 4 3 4 4 4 3 4 4 4 4 4 4 3 4 4 3 4 3 4 4 4 4 4 4 2 3 3 3 3 3 2 4 3 2 4 3 3 3 3 3 2 2 3 3 3 2 3 3 2 2 3 4 2 3 3 2 3 2 3 3 2 2 3 3 3 2 3 3 2 2 3 4 2 3 3 2 3 2 3 3 2 2 2 3 2 3 2 3 3 3 3 3 3 2 3 3 2 3 2 3 2 2 2 3 2 3 2 3 3 3 3 3 3 2 3 3 2 3 2 3 2 2 2 3 2 3 2 3 3 3 3 3 3 2 3 3 2 3 2 3 2 2 2 2 2 2 2 ...

result:

ok 3000000 numbers

Test #47:

score: 0
Accepted
time: 353ms
memory: 56104kb

input:

1431
240
1 2 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 20 20 20 20 24 24 24 24 24 24 24 24 24 24 24 35 35 35 35 35 35 41 41 43 43 43 43 43 43 43 43 51 43 43 43 43 43 43 43 59 43 43 43 43 43 43 66 66 66 66 66 66 66 66 74 66 66 66 66 66 66 66 82 66 66 66 66 66 66 89 90 89 92 89 89 89 89 89 89 89 89 89 89 89 ...

output:

4 4 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 5 5 3 5 4 5 3 5 4 4 4 4 4 4 4 4 4 3 5 4 4 4 4 3 5 3 4 4 4 4 4 4 4 3 5 4 4 4 4 4 4 3 5 4 4 4 4 4 3 4 4 4 4 4 4 4 3 5 4 4 4 4 4 4 3 5 4 4 4 4 4 3 3 5 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 3 3 4 4 4 4 4 4 3 4 4 4 4 4 4 4 3 4 4 4 4 4 4 3 3 4 4 4 4 4 4 3 4 4 4 4 4 4 4 ...

result:

ok 3000000 numbers

Test #48:

score: 0
Accepted
time: 410ms
memory: 58488kb

input:

970
14
1 2 3 4 5 6 7 8 9 10 11 12 13 14
202
1 2 3 1 1 6 7 8 6 6 11 11 11 11 11 16 17 18 16 16 21 21 21 21 21 21 21 21 21 21 21 21 21 21 35 21 21 21 21 21 21 21 43 21 45 21 21 48 48 48 48 48 48 48 48 48 48 48 48 48 48 62 48 48 48 48 48 48 48 70 48 72 48 48 75 75 75 75 75 75 75 75 75 75 75 75 75 75 89...

output:

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

result:

ok 3000000 numbers

Test #49:

score: 0
Accepted
time: 377ms
memory: 56000kb

input:

1042
58
1 2 2 2 2 6 6 6 6 10 10 10 10 14 15 14 14 18 18 20 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 36 40 36 36 36 36 45 36 36 36 49 49 49 49 49 49 49 49 49 49
55
1 1 3 3 5 5 7 7 9 9 11 11 13 14 15 16 15 15 19 15 21 15 15 24 15 15 15 15 15 30 31 30 30 34 30 36 30 30 39 30 30 30 30 30 45...

output:

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

result:

ok 3000000 numbers

Test #50:

score: 0
Accepted
time: 385ms
memory: 46952kb

input:

4220
101
1 2 3 1 1 1 7 1 1 10 1 1 13 1 1 1 17 1 19 1 21 22 23 21 21 21 27 21 21 30 21 21 33 21 21 21 37 21 39 21 41 42 43 41 41 41 47 41 41 50 41 41 53 41 41 41 57 41 59 41 61 62 63 61 61 61 67 61 61 70 61 61 73 61 61 61 77 61 79 61 81 81 81 81 81 81 81 81 81 81 81 81 81 81 95 95 95 81 81 81 101
251...

output:

2 2 2 3 3 3 2 3 3 2 3 3 2 3 3 3 2 3 2 3 2 2 2 3 3 3 2 3 3 2 3 3 2 3 3 3 2 3 2 3 2 2 2 3 3 3 2 3 3 2 3 3 2 3 3 3 2 3 2 3 2 2 2 3 3 3 2 3 3 2 3 3 2 3 3 3 2 3 2 3 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 3 2 2 1
8 9 8 8 9 9 9 9 8 8 8 9 7 8 7 7 8 8 8 8 7 7 7 8 6 7 6 6 7 7 7 7 6 6 6 8 6 6 6 7 7 7 7 6 7 7 7 7 5 ...

result:

ok 3000000 numbers

Test #51:

score: 0
Accepted
time: 374ms
memory: 30596kb

input:

1974
45
1 2 1 1 1 6 7 1 1 10 1 1 13 1 1 1 1 18 1 1 1 1 1 1 25 25 27 25 25 25 25 25 25 34 25 25 25 25 25 25 25 42 25 25 45
258
1 2 1 1 5 1 7 1 1 10 11 10 10 14 10 16 10 10 19 20 19 19 23 19 25 19 19 28 29 28 28 28 28 28 35 28 28 38 28 40 28 28 28 28 45 46 45 45 45 45 45 52 45 45 55 45 57 45 45 45 45 ...

output:

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

result:

ok 3000000 numbers

Test #52:

score: 0
Accepted
time: 361ms
memory: 43088kb

input:

3802
181
1 2 3 1 5 1 1 1 1 1 1 1 1 1 15 1 1 1 19 1 1 1 1 1 1 1 1 28 1 1 1 32 33 34 32 36 32 32 32 32 32 32 32 32 32 46 32 32 32 50 32 32 32 32 32 32 32 32 59 32 32 32 63 64 65 63 67 63 63 63 63 63 63 63 63 63 77 63 63 63 81 63 63 63 63 63 63 63 63 90 63 63 63 94 95 96 94 98 94 94 94 94 94 94 94 94 9...

output:

2 2 2 3 2 3 3 3 3 3 3 3 3 3 2 3 3 3 2 3 3 3 3 3 3 3 3 2 3 3 3 2 2 2 3 2 3 3 3 3 3 3 3 3 3 2 3 3 3 2 3 3 3 3 3 3 3 3 2 3 3 3 2 2 2 3 2 3 3 3 3 3 3 3 3 3 2 3 3 3 2 3 3 3 3 3 3 3 3 2 3 3 3 2 2 2 3 2 3 3 3 3 3 3 3 3 3 2 3 3 3 2 3 3 3 3 3 3 3 3 2 3 3 3 2 2 2 3 2 3 3 3 3 3 3 3 3 3 2 3 3 3 2 3 3 3 3 3 3 3 ...

result:

ok 3000000 numbers

Test #53:

score: 0
Accepted
time: 338ms
memory: 20380kb

input:

10893
178
1 2 3 4 1 1 1 1 9 1 11 1 13 14 15 16 13 13 13 13 21 13 23 13 25 26 27 28 25 25 25 25 33 25 35 25 37 38 39 37 41 42 37 37 37 37 47 37 49 50 51 49 53 54 49 49 49 49 59 49 61 61 63 61 61 61 61 68 61 61 61 61 61 74 61 76 77 76 76 76 81 82 81 76 85 86 85 76 89 90 89 89 89 94 95 94 89 98 99 98 8...

output:

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

result:

ok 3000000 numbers

Test #54:

score: 0
Accepted
time: 322ms
memory: 21672kb

input:

9514
59
1 2 3 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 1 1 1 1 1 1 1 1 28 29 30 28 28 28 28 28 28 28 28 28 28 28 42 28 28 28 28 28 28 28 28 28 28 28 28 55 56 55 58 58
61
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 18 1 1 21 1 1 1 1 1 27 28 29 30 31 30 33 34 33 36 37 38 39 40 41 42 43 44 45 45 45 48 48 48 51 51 51 54 ...

output:

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

result:

ok 3000000 numbers

Test #55:

score: 0
Accepted
time: 346ms
memory: 36144kb

input:

4645
288
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 27 1 1 30 1 1 1 1 1 1 1 1 39 1 41 42 41 44 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 81 81 81 81 81 81 81 81 89 89 89 92 92 92 92 92 92 92 92 100 100 100 103 104 105 103 103...

output:

5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 7 6 5 7 6 6 6 6 6 6 6 5 7 5 5 6 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 4 5 6 5 5 5 5 5 4 5 6 4 5 5 5 5 5 5 5 4 5 5 4 4 4 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 5 5 3 3 4 4 4 4 3 4 4 4 3 4 ...

result:

ok 3000000 numbers

Test #56:

score: 0
Accepted
time: 343ms
memory: 38468kb

input:

3324
23
1 1 1 1 1 1 1 1 1 1 1 1 1 14 15 16 14 18 14 20 21 22 23
3
1 2 1
61
1 1 3 4 5 3 7 3 3 3 3 12 12 12 15 12 12 12 19 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 36 36 36 39 36 36 36 43 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 60 61
200
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 16 1 18 1 20 1 1 1 ...

output:

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

result:

ok 3000000 numbers

Test #57:

score: 0
Accepted
time: 364ms
memory: 24668kb

input:

7013
248
1 2 1 1 1 1 1 1 1 1 11 1 1 1 1 1 17 1 1 1 1 1 1 24 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 44 45 44 44 44 44 44 44 44 44 54 44 44 44 44 44 60 44 44 44 44 44 44 67 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 87 87 87 87 91 87 87 87 87 96 87 98 87 87 87 87 87 87 87 106 87 87 87 87 ...

output:

6 6 7 7 7 7 7 7 7 7 6 7 7 7 7 7 6 7 7 7 7 7 7 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 6 7 7 7 7 7 7 7 7 6 7 7 7 7 7 6 7 7 7 7 7 7 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 5 6 6 6 5 7 6 6 6 5 7 5 7 6 6 6 6 6 6 5 7 6 6 6 6 6 5 7 5 7 6 6 6 6 6 6 5 7 6 6 5 5 6 6 5 6 5 5 6 6 5 6 5 5 6 6 5 6 4 5 5 4 5 5 ...

result:

ok 3000000 numbers

Test #58:

score: 0
Accepted
time: 360ms
memory: 30888kb

input:

9208
106
1 1 1 4 1 1 7 1 1 1 1 12 1 1 1 1 1 1 1 1 1 1 1 24 24 26 24 24 24 30 24 24 24 34 35 34 34 34 34 34 41 34 34 34 34 34 34 34 49 34 34 34 34 34 55 56 55 55 55 55 55 55 55 55 55 55 55 55 69 55 55 55 55 55 55 76 77 76 76 76 76 76 76 76 76 76 76 76 76 90 76 76 76 76 76 76 97 97 97 97 97 102 102 10...

output:

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

result:

ok 3000000 numbers

Test #59:

score: 0
Accepted
time: 346ms
memory: 33168kb

input:

7898
83
1 2 3 4 1 1 7 1 1 1 1 12 13 12 15 12 12 12 12 20 12 12 23 24 23 26 23 23 23 23 31 23 23 34 35 34 37 34 34 34 34 42 34 34 45 46 45 48 45 45 45 45 53 45 45 56 57 56 59 56 56 56 56 64 56 56 67 68 67 70 67 67 67 67 75 67 67 78 79 80 81 82 83
275
1 1 3 1 1 1 1 1 9 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

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

result:

ok 3000000 numbers

Test #60:

score: 0
Accepted
time: 388ms
memory: 53448kb

input:

22
85
1 1 1 4 1 1 1 1 1 10 1 1 1 1 1 1 17 18 17 17 17 17 17 17 17 17 17 17 17 17 31 17 33 17 17 36 37 36 36 36 36 36 36 36 36 46 36 36 36 36 36 36 36 36 55 56 55 55 55 55 55 55 55 55 65 55 55 55 55 55 55 55 55 74 75 76 77 78 79 80 81 82 81 84 85
29
1 2 1 4 1 6 1 1 9 1 11 1 13 14 13 16 13 18 13 13 21...

output:

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

result:

ok 3000000 numbers

Test #61:

score: 0
Accepted
time: 383ms
memory: 55932kb

input:

629
242
1 2 1 1 5 1 1 1 9 1 1 1 1 1 1 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 34 1 36 1 1 1 1 1 1 43 1 1 1 1 1 1 1 51 1 53 54 53 53 57 53 53 53 53 53 53 53 53 53 53 53 53 53 53 72 53 74 75 74 74 74 74 74 74 82 74 74 74 86 74 74 74 74 74 74 74 74 74 74 97 74 99 100 99 99 99 99 99 99 107 99 99 99 111 99 ...

output:

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

result:

ok 3000000 numbers

Test #62:

score: 0
Accepted
time: 334ms
memory: 38328kb

input:

7983
121
1 2 1 1 5 1 1 1 1 1 1 1 1 1 1 1 17 1 1 1 1 22 1 1 1 26 27 26 26 1 1 1 33 1 1 1 1 1 1 1 1 1 1 1 1 46 47 46 46 50 46 46 46 46 46 46 46 46 46 46 46 62 46 46 46 46 67 46 46 46 71 72 71 71 46 46 46 78 46 46 46 46 46 46 46 46 46 46 46 46 91 92 91 91 91 91 91 91 99 91 91 91 91 91 91 91 91 91 91 91...

output:

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

result:

ok 3000000 numbers

Test #63:

score: 0
Accepted
time: 383ms
memory: 40440kb

input:

933
51
1 1 3 3 5 1 1 1 1 1 1 1 1 14 14 1 17 17 19 19 21 17 17 17 17 17 17 17 17 30 30 17 33 33 33 36 33 33 33 33 33 33 33 33 33 33 33 33 49 50 51
203
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 18 19 18 18 18 18 18 18 18 27 18 18 30 18 18 18 18 18 18 18 18 18 18 18 18 43 18 18 18 18 18 18 18 18 52 53 52 52 52...

output:

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

result:

ok 3000000 numbers

Test #64:

score: 0
Accepted
time: 351ms
memory: 26044kb

input:

5874
77
1 2 1 1 5 1 1 1 1 1 1 12 13 1 1 16 1 1 19 1 1 1 1 24 1 1 1 1 1 1 31 1 1 1 1 1 1 38 38 38 41 41 41 41 41 41 41 41 41 50 41 41 41 41 41 41 57 41 41 41 41 62 62 41 41 41 41 41 69 41 41 41 41 41 41 76 76
281
1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9 17 17 17 17 17 17 17 17 25 25 25 25 25 25 25 25 33 34 33...

output:

2 2 3 3 2 3 3 3 3 3 3 2 2 4 3 2 3 3 2 3 3 3 3 2 3 3 3 3 3 3 2 3 3 3 3 3 3 1 2 3 1 2 2 2 2 2 2 2 2 1 3 2 2 2 2 2 1 3 2 2 2 1 2 3 2 2 2 2 1 3 2 2 2 2 2 1 2
3 4 4 4 4 4 4 4 3 4 4 4 4 4 4 4 3 4 4 4 4 4 4 4 3 4 4 4 4 4 4 4 3 3 4 4 4 3 3 5 3 3 4 4 4 3 3 5 2 8 2 8 3 3 2 8 2 7 2 7 3 3 2 7 2 6 2 6 3 3 2 6 2 ...

result:

ok 3000000 numbers

Test #65:

score: 0
Accepted
time: 329ms
memory: 9268kb

input:

17607
275
1 2 1 4 1 1 1 8 1 1 1 12 1 1 1 16 1 18 1 1 1 1 1 1 25 26 25 28 25 25 25 32 25 25 25 36 25 25 25 40 25 42 25 25 25 25 25 25 49 50 49 52 49 49 49 56 49 49 49 60 49 49 49 64 49 66 49 49 49 49 49 49 73 74 73 73 77 73 73 73 73 73 83 73 73 73 73 73 89 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73...

output:

2 2 4 2 3 3 3 2 3 3 3 2 3 3 3 2 3 2 3 3 3 3 3 3 2 2 4 2 3 3 3 2 3 3 3 2 3 3 3 2 3 2 3 3 3 3 3 3 2 2 4 2 3 3 3 2 3 3 3 2 3 3 3 2 3 2 3 3 3 3 3 3 2 2 3 3 2 3 3 3 3 3 2 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 2 3 3 3 3 3 2 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 ...

result:

ok 3000000 numbers

Test #66:

score: 0
Accepted
time: 348ms
memory: 31488kb

input:

9250
142
1 2 3 1 1 6 1 1 9 1 1 1 1 1 15 1 1 1 1 1 1 1 1 1 1 1 1 28 1 1 1 1 1 1 1 36 1 1 1 1 1 1 1 1 1 46 47 48 46 46 51 46 46 54 46 46 46 46 46 60 46 46 46 46 46 46 46 46 46 46 46 46 73 46 46 46 46 46 46 46 81 46 46 46 46 46 46 46 46 46 91 92 93 91 91 96 91 91 99 91 91 91 91 91 105 91 91 91 91 91 91...

output:

1 1 1 2 2 1 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 1 1 2 2 1 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 1 1 2 2 1 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
4 5 5 5 6 4 5 6 ...

result:

ok 3000000 numbers

Test #67:

score: 0
Accepted
time: 385ms
memory: 47568kb

input:

941
299
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 16 16 19 20 19 22 23 22 25 26 25 28 28 30 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 54 28 28 28 28 28 28 28 28 28 28 65 28 28 28 28 28 28 72 72 28 28 28 28 28 28 80 80 82 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 8...

output:

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 5 4 4 5 4 4 5 4 4 5 3 4 3 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 5 4 4 4 4 4 4 4 4 4 3 5 4 4 4 4 4 3 4 4 4 4 4 4 4 3 4 3 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 5 4 4 4 4 4 4 4 4 4 3 5 4 4 4 4 4 3 4 4 4 4 4 4 4 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ...

result:

ok 3000000 numbers

Test #68:

score: 0
Accepted
time: 331ms
memory: 42680kb

input:

5947
167
1 1 3 1 1 1 1 1 9 1 1 1 13 13 15 13 13 13 13 13 21 13 13 13 25 25 25 25 25 30 25 25 25 25 25 25 25 25 25 40 25 25 43 25 25 25 25 25 49 25 51 51 25 25 55 25 25 58 25 25 25 25 25 25 65 25 25 25 25 25 25 72 25 74 25 25 25 25 25 25 81 81 81 81 81 86 81 81 81 81 81 81 81 81 81 96 81 81 99 81 81 ...

output:

2 4 2 5 3 3 3 3 2 5 3 3 2 4 2 5 3 3 3 3 2 5 3 3 2 3 3 3 3 2 4 3 3 3 3 3 3 3 3 2 4 3 2 4 3 3 3 3 2 4 2 3 4 3 2 4 3 2 4 3 3 3 3 3 2 4 3 3 3 3 3 2 4 2 4 3 3 3 3 3 2 3 3 3 3 2 4 3 3 3 3 3 3 3 3 2 4 3 2 4 3 3 3 3 2 4 2 3 4 3 2 4 3 2 4 3 3 3 3 3 2 4 3 3 3 3 3 2 4 2 4 3 3 3 3 3 2 2 2 3 2 3 3 3 3 3 3 3 3 3 ...

result:

ok 3000000 numbers

Test #69:

score: 0
Accepted
time: 388ms
memory: 44744kb

input:

5573
50
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 16 16 19 19 19 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 44 45 44 47 44 49 49
160
1 1 1 1 1 6 6 8 8 10 6 6 6 6 6 6 6 6 19 19 19 19 19 24 24 26 26 28 24 24 24 24 24 24 24 24 37 37 37 37 37 42 42 44 44 46 42 42 42 42 42 42 42 42 55 55 55...

output:

2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 2 3 1 2
2 10 3 3 3 2 10 2 10 2 11 3 3 3 3 3 3 3 2 9 3 3 3 2 9 2 9 2 10 3 3 3 3 3 3 3 2 8 3 3 3 2 8 2 8 2 9 3 3 3 3 3 3 3 2 7 3 3 3 2 7 2 7 2 8 3 3 3 3 3 3 3 2 6 3 3 3 2 6 2 6 2 7 3 3 3 3 3 3 3 2 5 3 3 3 2 5 2...

result:

ok 3000000 numbers

Test #70:

score: 0
Accepted
time: 345ms
memory: 27760kb

input:

10516
139
1 1 1 1 1 6 6 6 1 10 10 10 10 10 15 15 15 10 19 19 19 22 19 19 19 26 19 19 19 19 19 19 19 19 19 19 19 19 19 19 41 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 59 19 19 19 19 19 19 19 19 19 19 19 19 19 73 73 73 76 73 73 73 80 73 73 73 73 73 73 73 73 73 73 73 73 73 73 95 73 73 73 73 73...

output:

1 2 2 2 2 1 2 2 3 1 2 2 2 2 1 2 2 3 1 2 2 1 3 2 2 1 3 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 1 3 2 2 1 3 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 1 2 2 2 1 1
1 2 2 2 2 2 2 1 3 2 2 ...

result:

ok 3000000 numbers

Test #71:

score: 0
Accepted
time: 355ms
memory: 24088kb

input:

10974
153
1 2 1 1 1 6 1 1 1 1 11 1 1 1 1 16 1 1 1 1 1 1 1 1 1 26 27 1 1 1 1 32 33 32 32 32 37 32 32 32 32 42 32 32 32 32 47 32 32 32 32 32 32 32 32 32 57 58 32 32 32 32 63 64 63 63 67 68 67 67 71 72 71 71 75 76 75 75 79 80 79 79 83 79 79 79 87 79 89 79 79 92 93 92 79 79 79 79 79 100 79 79 79 104 105...

output:

1 1 2 3 2 1 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 1 3 2 2 2 1 1 2 3 2 1 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 1 3 2 2 2 1 1 2 3 1 1 2 3 1 1 2 3 1 1 2 3 1 1 2 2 1 2 2 2 1 2 1 2 2 1 1 2 3 2 2 2 2 1 2 2 2 1 1 3 2 1 2 2 2 2 2 1 2 1 1 3 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 2 1 ...

result:

ok 3000000 numbers

Test #72:

score: 0
Accepted
time: 349ms
memory: 49704kb

input:

2675
272
1 1 1 1 1 1 1 8 1 10 1 1 1 1 15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 40 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 59 1 1 62 62 62 62 62 62 62 69 62 71 62 62 62 62 76 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 101 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62...

output:

2 3 3 3 3 3 3 2 4 2 4 3 3 3 2 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 4 3 2 3 3 3 3 3 3 2 4 2 4 3 3 3 2 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 4 3 2 3 3 3 3 3 3 2 4 2 4 3 3 3 2 4 3 3 3 3 3 3 3 3 3 3 3 3 ...

result:

ok 3000000 numbers

Test #73:

score: 0
Accepted
time: 346ms
memory: 32016kb

input:

7414
31
1 2 1 4 1 1 1 1 1 1 1 12 1 14 1 16 1 18 18 18 21 21 23 24 23 26 27 28 29 30 26
33
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
11
1 2 2 2 5 5 5 8 9 10 11
154
1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 17 1 1 1 21 1 1 1 25 25 25 25 25 25 25 25 25 34 25 25 25...

output:

2 2 3 2 3 3 3 3 3 3 3 2 3 2 3 2 3 1 2 2 1 2 1 1 2 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 1 2 2 1 2 2 1 1 1 1
1 2 2 2 2 2 2 2 2 1 3 2 2 2 2 2 1 3 2 2 1 3 2 2 1 2 2 2 2 2 2 2 2 1 3 2 2 2 2 2 1 3 2 2 1 3 2 2 1 2 2 2 2 2 2 2 2 1 3 2 2 2 2 2 1 3 2 2 1 3 2 2 1 2 2 ...

result:

ok 3000000 numbers

Test #74:

score: 0
Accepted
time: 356ms
memory: 42576kb

input:

3064
252
1 2 1 1 1 1 1 8 1 1 1 1 1 1 1 1 17 18 1 20 1 1 23 1 1 26 1 1 1 1 1 1 1 1 1 36 37 1 39 1 41 1 1 44 1 46 1 1 1 50 1 1 53 1 55 1 1 58 59 60 58 58 58 58 58 58 67 58 58 58 58 58 58 58 58 58 58 58 58 80 81 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5...

output:

1 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 1 1 3 1 2 2 1 2 2 1 2 2 2 2 2 2 2 2 2 1 1 3 1 2 1 2 2 1 2 1 2 2 2 1 2 2 1 2 1 2 2 1 1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 ...

result:

ok 3000000 numbers

Test #75:

score: 0
Accepted
time: 333ms
memory: 39336kb

input:

3382
99
1 2 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 22 1 1 1 1 1 1 1 1 31 32 31 31 31 36 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 52 31 31 31 31 31 31 31 31 61 61 61 61 61 66 61 61 61 61 61 61 61 61 61 76 61 61 61 61 61 61 61 61 85 85 87 87 85 90 90 92 92 90 95 95 95 95 99
53
1 1 1 1 1 1 1 1 1 10 ...

output:

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

result:

ok 3000000 numbers

Test #76:

score: 0
Accepted
time: 350ms
memory: 44008kb

input:

1048
91
1 2 1 1 1 6 1 1 1 10 1 1 1 1 1 1 1 1 19 20 19 19 19 24 19 19 19 28 19 19 19 19 19 19 19 19 37 38 37 37 37 42 37 37 37 46 37 37 37 37 37 37 37 37 55 55 55 55 55 55 55 55 55 55 65 55 55 55 55 55 55 55 73 73 73 73 73 73 73 73 73 73 83 73 73 73 73 73 73 73 91
46
1 1 1 1 1 1 1 8 1 1 1 1 1 1 1 1 1...

output:

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

result:

ok 3000000 numbers

Test #77:

score: 0
Accepted
time: 348ms
memory: 39088kb

input:

4549
119
1 2 1 1 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 24 25 26 27 24 24 24 31 32 24 24 24 24 37 24 39 24 24 24 43 24 24 46 24 24 49 24 24 24 24 24 24 24 24 24 24 24 24 24 63 64 63 66 63 68 63 70 63 72 63 63 63 63 63 63 63 63 81 82 81 84 81 86 81 88 81 90 81 81 81 81 81 81 81 81 99 100 99 102 99 104...

output:

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

result:

ok 3000000 numbers

Test #78:

score: 0
Accepted
time: 397ms
memory: 54432kb

input:

2504
74
1 2 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 1 1 1 1 24 1 26 27 26 26 30 26 26 33 26 35 26 26 26 39 26 26 26 26 26 45 26 26 48 26 26 51 51 51 54 51 56 51 51 59 59 59 51 51 51 51 51 51 51 69 69 69 69 69 74
178
1 2 1 1 5 1 1 1 9 10 9 9 13 9 9 9 17 18 17 17 21 17 17 17 25 26 25 25 29 25 25 25 33 34 3...

output:

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

result:

ok 3000000 numbers

Test #79:

score: 0
Accepted
time: 370ms
memory: 36244kb

input:

373
279
1 2 3 1 1 6 7 8 1 1 11 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 28 1 1 1 32 1 34 35 34 34 34 39 34 41 34 34 34 34 34 34 34 34 34 34 34 34 54 34 56 34 58 34 34 34 62 34 34 34 34 67 68 69 67 71 72 73 71 75 76 77 75 75 75 81 75 83 75 75 75 75 75 75 75 75 75 75 75 75 96 75 75 75 75 75 75 75 75 75 75 75 ...

output:

4 4 4 5 5 4 4 4 6 5 4 5 5 5 5 5 5 5 5 4 5 5 5 5 5 5 5 4 5 5 5 4 5 3 3 4 4 4 3 4 3 4 4 4 4 4 4 4 4 4 4 4 4 3 4 3 4 3 4 4 4 3 4 4 4 4 3 3 3 5 3 3 3 5 3 3 3 4 4 4 3 4 3 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 4 4 4 4 4 4 4 4 4 3 4 4 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ...

result:

ok 3000000 numbers

Test #80:

score: 0
Accepted
time: 367ms
memory: 46536kb

input:

96
36
1 1 1 1 1 1 7 1 1 1 1 1 1 1 1 16 16 16 16 16 21 22 23 21 25 26 27 28 29 30 31 32 33 34 35 36
133
1 1 1 4 1 6 1 1 9 10 9 12 13 12 12 16 12 18 12 12 12 12 12 12 12 12 27 12 12 12 12 32 33 32 32 36 32 38 32 32 32 32 32 32 32 32 47 32 32 32 32 52 53 52 52 56 52 58 52 52 52 52 52 52 52 52 67 52 52 ...

output:

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

result:

ok 3000000 numbers

Test #81:

score: 0
Accepted
time: 361ms
memory: 20828kb

input:

10158
55
1 2 1 1 5 1 1 1 1 10 1 1 13 1 15 1 1 1 1 1 1 1 1 1 1 1 27 1 1 1 1 1 1 1 1 1 37 38 37 37 37 37 37 37 45 37 37 37 37 50 37 52 37 37 37
27
1 2 3 1 1 1 7 8 1 1 11 1 1 1 15 1 1 1 1 1 1 1 23 24 25 26 27
48
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 3...

output:

1 1 2 3 1 2 2 2 2 1 2 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 1 2 2 2 2 1 2 1 2 2 2
1 1 1 2 2 2 1 1 2 2 1 2 2 2 1 2 2 2 2 2 2 2 1 1 1 1 1
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 3 2 2 2 3 1 2 1
2 2 2 3 3 3 2 3 2 3 3 3 2 3 3 3 2 3 2 2 ...

result:

ok 3000000 numbers

Test #82:

score: 0
Accepted
time: 349ms
memory: 61276kb

input:

176
1
1
2970070
1 2 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 1 21 1 1 1 1 1 1 28 1 1 1 1 1 1 1 1 1 1 1 40 1 1 1 1 1 1 47 1 1 1 1 1 1 1 1 1 1 58 1 1 61 1 1 1 1 1 1 1 1 70 1 1 73 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 89 1 91 1 1 1 1 1 1 1 1 100 1 1 1 1 1 1 1 1 1 1 111 1 1 1 1 1 117 1 1 1 1 1 1 1 1 1 1 128 1 1 1 1 1...

output:

1
5071 5071 5072 5072 5072 5072 5072 5072 5072 5072 5072 5072 5072 5071 5072 5072 5072 5072 5072 5072 5071 5072 5072 5072 5072 5072 5072 5071 5072 5072 5072 5072 5072 5072 5072 5072 5072 5072 5072 5071 5072 5072 5072 5072 5072 5072 5071 5072 5072 5072 5072 5072 5072 5072 5072 5072 5072 5071 5072 507...

result:

ok 3000000 numbers

Test #83:

score: 0
Accepted
time: 363ms
memory: 43564kb

input:

1333
173
1 1 1 1 1 1 1 1 1 1 11 11 11 11 15 11 17 11 11 11 11 22 22 11 11 26 11 11 11 11 11 11 11 11 11 11 11 38 38 40 38 38 38 38 38 38 38 38 38 50 50 38 38 38 38 38 57 38 38 38 61 38 38 38 38 38 38 38 69 38 38 38 38 38 75 76 77 78 79 75 75 75 75 75 75 75 75 75 75 75 91 75 75 94 95 75 75 75 99 100 ...

output:

2 3 3 3 3 3 3 3 3 3 2 3 3 3 2 4 2 4 3 3 3 2 3 4 3 2 4 3 3 3 3 3 3 3 3 3 3 2 3 2 4 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 2 4 3 3 2 4 3 3 3 3 3 3 2 4 3 3 3 3 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 2 3 3 2 2 3 3 3 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 2 3 3 2 2 3 3 3 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 2 3 3 2 2 3 3 3 2 2 2 2 ...

result:

ok 3000000 numbers

Test #84:

score: 0
Accepted
time: 353ms
memory: 25760kb

input:

11390
78
1 1 1 1 1 1 1 8 1 1 11 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 27 27 1 30 1 1 1 34 1 1 1 1 1 1 1 1 1 1 1 1 47 1 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 67 68 67 70 70 70 70 74 75 76 77 78
183
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 18 1 1 21 21 1 1 1 1 1 28 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

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

result:

ok 3000000 numbers

Test #85:

score: 0
Accepted
time: 374ms
memory: 35848kb

input:

527
5
1 2 1 4 5
238
1 2 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 21 1 1 1 25 1 1 1 1 1 1 1 1 34 1 1 1 1 39 1 1 1 1 1 1 1 47 1 49 1 1 1 1 1 55 1 1 1 1 1 1 1 1 1 1 1 1 68 1 1 1 1 73 74 1 1 1 1 1 1 1 82 83 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 108 82 82 82 112 82 114 82 82...

output:

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

result:

ok 3000000 numbers

Test #86:

score: 0
Accepted
time: 322ms
memory: 30212kb

input:

6526
76
1 1 1 4 4 4 7 8 7 10 7 7 13 14 13 16 13 13 19 20 19 22 19 19 25 25 25 25 25 25 31 31 31 31 31 31 31 31 31 40 31 31 43 31 31 31 47 31 49 31 31 31 53 31 31 31 31 58 31 31 31 31 31 31 65 31 31 31 31 31 31 31 31 74 75 76
299
1 2 1 1 1 1 1 1 1 1 1 12 1 1 1 1 1 18 1 1 1 1 23 1 1 1 27 28 1 1 1 1 33...

output:

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

result:

ok 3000000 numbers

Test #87:

score: 0
Accepted
time: 345ms
memory: 50780kb

input:

2889
204
1 2 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 33 1 1 1 1 38 1 1 1 1 1 44 1 1 1 1 1 1 1 1 1 1 1 1 1 1 59 1 1 62 1 1 1 1 1 1 69 70 71 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 101 69 69 69 69 106 69 69 69 69 69 112 69 69 69 69 69 ...

output:

2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 2 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 2 3 3 3 3 3 3 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 2 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 2 3 3 3 3 3 3 1 1 2 2 2 2 2 1 2 2 2 2 2 2 ...

result:

ok 3000000 numbers

Test #88:

score: 0
Accepted
time: 356ms
memory: 45712kb

input:

1885
139
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 30 31 30 30 30 30 30 30 30 30 30 30 30 43 30 45 30 30 30 30 30 30 30 30 30 55 30 30 30 30 30 30 30 30 30 30 30 30 30 69 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 96 30 30 30 30 30 102 30 30 30 30 3...

output:

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

result:

ok 3000000 numbers

Test #89:

score: 0
Accepted
time: 412ms
memory: 61772kb

input:

1
3000000
1 2 1 4 4 6 7 6 9 9 11 12 11 14 14 16 17 16 19 19 21 22 21 24 24 26 27 26 29 29 31 32 31 34 34 36 37 36 39 39 41 42 41 44 44 46 47 46 49 49 51 52 51 54 54 56 57 56 59 59 61 62 61 64 64 66 67 66 69 69 71 72 71 74 74 76 77 76 79 79 81 82 81 84 84 86 87 86 89 89 91 92 91 94 94 96 97 96 99 99 ...

output:

600001 600001 600002 600000 600001 600000 600000 600001 599999 600000 599999 599999 600000 599998 599999 599998 599998 599999 599997 599998 599997 599997 599998 599996 599997 599996 599996 599997 599995 599996 599995 599995 599996 599994 599995 599994 599994 599995 599993 599994 599993 599993 599994...

result:

ok 3000000 numbers