QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#293879#6301. Minimum SuffixningagoAC ✓153ms48488kbC++144.3kb2023-12-29 21:42:192023-12-29 21:42:20

Judging History

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

  • [2023-12-29 21:42:20]
  • 评测
  • 测评结果:AC
  • 用时:153ms
  • 内存:48488kb
  • [2023-12-29 21:42:19]
  • 提交

answer

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <random> 

namespace uvu
{
#define LOCAL ________________don_t_define_me_________________
#define ll long long
#define inf 0x3f3f3f3f
//#define int long long
//#define inf 0x3f3f3f3f3f3f3f3fll
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define gline debug("now is #%d\n", __LINE__)
#define pii std::pair <int, int>
#define mkp std::make_pair
#define fi first
#define se second
char _ST_;
const int BUFSIZE = 4000010;
char ibuf[BUFSIZE], *iS = ibuf, *iT = ibuf;
char obuf[BUFSIZE], *oS = obuf, *oT = obuf + BUFSIZE;
char getc()
{
#ifdef LOCAL
	return getchar();
#else
	if(iS == iT) iT = (iS = ibuf) + fread(ibuf, 1, BUFSIZE, stdin);
	return iS == iT ? EOF : *iS++;
#endif
}
void Flush()
{
	fwrite(obuf, 1, oS - obuf, stdout);
	oS = obuf;
}
struct Flusher{ ~Flusher() { Flush(); } }iamflusher;
void putc(char c)
{
#ifdef LOCAL
	putchar(c);
#else
	*oS++ = c;
	if(oS == oT) Flush();
#endif
}

template <typename T = int> T read()
{
	T x = 0, f = 1; char c = getc(); 
	for(; !isdigit(c); c = getc()) if(c == '-') f = -1;
	for(;  isdigit(c); c = getc()) x = (x << 3) + (x << 1) + (c ^ 48);
	return x * f;
}

template <typename T> void print(T x, char c)
{
static int sta[BUFSIZE], top;
	top = 0;
	if(x < 0) putc('-'), x = -x;
	if(!x) sta[++top] = 0;
	for(; x; x /= 10) sta[++top] = x % 10;
	for(; top; top--) putc(sta[top] ^ 48);
	if(c) putc(c);
}

int readstr(char *s, int base)
{
	int idx = base - 1; char c = getc();
	for(; !isdigit(c) && !isalpha(c) && c != '+' && c != '-'; c = getc());
	for(;  isdigit(c) ||  isalpha(c) || c == '+' || c == '-'; c = getc()) s[++idx] = c;
	return idx - base + 1;
}

void printstr(const char *s) { for(; *s; s++) putc(*s); }
void printf(const char *s) { printstr(s); }
template <typename T, typename ... Args> 
void printf(const char *s, T x, Args ... rest)
{
	for(; *s; s++)
	{
		if(*s != '%') { putc(*s); continue; }
		s++; if(*s == 'd') print(x, 0);
		else if(*s == 'c') putc(x);
		printf(s + 1, rest ...);
		return;
	}
}

template <typename T> void ckmax(T &x, T y) { x = x > y ? x : y; }
template <typename T> void ckmin(T &x, T y) { x = x < y ? x : y; }
template <typename T> T gcd(T x, T y) { for(; y; x %= y, x ^= y ^= x ^= y); return x; }
#define mod 998244353
//#define mod 1000000007
int sm(int x) { return x >= mod ? x - mod : x; } 
void plus_(int &x, int y) { x = sm(x + y); }
void mul_(int &x, int y) { x = 1ll * x * y % mod; }
int ksm(int a, int b) { int res = 1; for(; b; b >>= 1, mul_(a, a)) if(b & 1) mul_(res, a); return res; }

#define N 3000010
int n, m;
int p[N], last[N], s[N]; 
#define NO { printf("-1\n"); return; }
int pre[N]; bool val[N];
int lst(int x) { if(x > m) return 0; return last[x]; }
void solve()
{
//	memset(h, idx = -1, sizeof(h));
	m = 0;
	n = read(); for(int i = 1; i <= n; i++) p[i] = read();
	for(int r = n, l; r >= 1; r = l - 1)
	{
		val[l = p[r]] = 1; for(int i = l; i <= r; i++) if(p[i] < l) NO;
		for(int i = l + 1, len = 1; i <= r; i++)
		{
			pre[i] = i - len;
			if(p[i] == l) { val[i] = 1; len = i - l + 1; }
			else if(i - p[i] == i - len - p[i - len]) val[i] = 0;
			else NO;
		}
		bool big = 0;
		s[l] = lst(1);
		for(int i = l + 1, j; i <= r; i++)
		{
			s[i] = s[pre[i]] + val[i];
			if(s[i] > lst(i - l + 1)) big = 1;
//			printf("i = %d, big = %d, s[%d] = %d, lst = %d, val = %d\n", i, big, i, s[i], lst(i - l + 1), val[i]);
			if(!big && s[i] < lst(i - l + 1))
			{
				if(val[i]) s[i] = lst(i - l + 1);
				else { for(j = i; !val[j]; j--); s[i = j]++; big = 1; }
			}
		}
//		printf("[%d %d] big = %d\n", l, r, big);
		if(!big && r - l + 1 < m)
		{
			int i, j;
			for(j = r; !val[j]; j--); s[i = j]++; big = 1;
			for(i++; i <= r; i++) s[i] = s[pre[i]] + val[i];
		}
		m = r - l + 1;
		for(int i = l; i <= r; i++) last[i - l + 1] = s[i];
	}
	for(int i = 1; i <= n; i++) print(s[i] + 1, ' '); putc('\n');
}

void init()
{
	
}

char _ED_;
void mian()
{
	debug("%.3f MB\n", abs(&_ST_ - &_ED_) / 1024.0 / 1024);
	init();
	for(int T = read(); T; solve(), T--);
}
#ifdef int
	#undef int
#endif
}

int main()
{
	uvu::mian();
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 16168kb

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: 0ms
memory: 16172kb

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: 16168kb

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: 0ms
memory: 16160kb

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...

result:

ok 256 numbers

Test #5:

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

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
-...

result:

ok 1165 numbers

Test #6:

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

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
...

result:

ok 6438 numbers

Test #7:

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

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...

result:

ok 44590 numbers

Test #8:

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

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...

result:

ok 17638 numbers

Test #9:

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

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 ...

result:

ok 54425 numbers

Test #10:

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

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 
-...

result:

ok 168246 numbers

Test #11:

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

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 
...

result:

ok 211133 numbers

Test #12:

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

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: 0ms
memory: 16156kb

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 
...

result:

ok 39406 numbers

Test #14:

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

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...

result:

ok 173800 numbers

Test #15:

score: 0
Accepted
time: 17ms
memory: 16132kb

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
...

result:

ok 181240 numbers

Test #16:

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

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: 13ms
memory: 16156kb

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: 17ms
memory: 16128kb

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: 14ms
memory: 16168kb

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 
...

result:

ok 254500 numbers

Test #20:

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

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: 10ms
memory: 16168kb

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...

result:

ok 154428 numbers

Test #22:

score: 0
Accepted
time: 24ms
memory: 16136kb

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...

result:

ok 999990 numbers

Test #23:

score: 0
Accepted
time: 25ms
memory: 16068kb

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...

result:

ok 999990 numbers

Test #24:

score: 0
Accepted
time: 29ms
memory: 16104kb

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...

result:

ok 1000000 numbers

Test #25:

score: 0
Accepted
time: 24ms
memory: 16172kb

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...

result:

ok 1000000 numbers

Test #26:

score: 0
Accepted
time: 24ms
memory: 16176kb

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 ...

result:

ok 999991 numbers

Test #27:

score: 0
Accepted
time: 28ms
memory: 16136kb

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 ...

result:

ok 999991 numbers

Test #28:

score: 0
Accepted
time: 27ms
memory: 16172kb

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 ...

result:

ok 999991 numbers

Test #29:

score: 0
Accepted
time: 29ms
memory: 16168kb

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 ...

result:

ok 999990 numbers

Test #30:

score: 0
Accepted
time: 25ms
memory: 16172kb

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 ...

result:

ok 999990 numbers

Test #31:

score: 0
Accepted
time: 24ms
memory: 16136kb

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 ...

result:

ok 999990 numbers

Test #32:

score: 0
Accepted
time: 25ms
memory: 16132kb

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...

result:

ok 999989 numbers

Test #33:

score: 0
Accepted
time: 24ms
memory: 16172kb

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...

result:

ok 999989 numbers

Test #34:

score: 0
Accepted
time: 23ms
memory: 16224kb

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...

result:

ok 999989 numbers

Test #35:

score: 0
Accepted
time: 24ms
memory: 16172kb

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...

result:

ok 1000000 numbers

Test #36:

score: 0
Accepted
time: 30ms
memory: 16172kb

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...

result:

ok 1000000 numbers

Test #37:

score: 0
Accepted
time: 23ms
memory: 16064kb

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...

result:

ok 1000000 numbers

Test #38:

score: 0
Accepted
time: 27ms
memory: 16156kb

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...

result:

ok 1000000 numbers

Test #39:

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

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: 68ms
memory: 16248kb

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 ...

result:

ok 3000000 numbers

Test #41:

score: 0
Accepted
time: 111ms
memory: 45424kb

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: 112ms
memory: 42636kb

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: 120ms
memory: 42960kb

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: 103ms
memory: 36936kb

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: 102ms
memory: 41480kb

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: 97ms
memory: 33688kb

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: 113ms
memory: 48464kb

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: 106ms
memory: 47348kb

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: 104ms
memory: 47284kb

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 ...

result:

ok 3000000 numbers

Test #50:

score: 0
Accepted
time: 93ms
memory: 43808kb

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: 105ms
memory: 36016kb

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: 97ms
memory: 41432kb

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: 81ms
memory: 28432kb

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: 88ms
memory: 29396kb

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...

result:

ok 3000000 numbers

Test #55:

score: 0
Accepted
time: 101ms
memory: 37460kb

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: 106ms
memory: 40412kb

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...

result:

ok 3000000 numbers

Test #57:

score: 0
Accepted
time: 76ms
memory: 29556kb

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: 87ms
memory: 35916kb

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: 91ms
memory: 37056kb

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: 98ms
memory: 48488kb

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 ...

result:

ok 3000000 numbers

Test #61:

score: 0
Accepted
time: 100ms
memory: 48480kb

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: 84ms
memory: 36744kb

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 ...

result:

ok 3000000 numbers

Test #63:

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

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: 87ms
memory: 29584kb

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: 71ms
memory: 20604kb

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: 83ms
memory: 33884kb

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: 113ms
memory: 45348kb

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: 92ms
memory: 42064kb

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: 91ms
memory: 42724kb

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 ...

result:

ok 3000000 numbers

Test #70:

score: 0
Accepted
time: 89ms
memory: 33776kb

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: 72ms
memory: 29524kb

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: 102ms
memory: 48264kb

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: 76ms
memory: 34796kb

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...

result:

ok 3000000 numbers

Test #74:

score: 0
Accepted
time: 87ms
memory: 42296kb

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: 91ms
memory: 37796kb

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: 107ms
memory: 41864kb

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 ...

result:

ok 3000000 numbers

Test #77:

score: 0
Accepted
time: 100ms
memory: 39680kb

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: 103ms
memory: 46040kb

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: 106ms
memory: 38088kb

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: 89ms
memory: 42876kb

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: 81ms
memory: 29316kb

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...

result:

ok 3000000 numbers

Test #82:

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

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 50...

result:

ok 3000000 numbers

Test #83:

score: 0
Accepted
time: 101ms
memory: 39848kb

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: 74ms
memory: 31512kb

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: 90ms
memory: 36192kb

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: 95ms
memory: 33784kb

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: 96ms
memory: 45704kb

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: 93ms
memory: 42308kb

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: 153ms
memory: 46788kb

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