QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#95128#6301. Minimum SuffixRemocuzAC ✓371ms132440kbC++143.5kb2023-04-09 08:52:022023-04-09 08:52:06

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-09 08:52:06]
  • 评测
  • 测评结果:AC
  • 用时:371ms
  • 内存:132440kb
  • [2023-04-09 08:52:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
void print(vector<int> x){for(int i=0;i<(int)x.size();i++) printf("%d%c",x[i]," \n"[i==(int)x.size()-1]);}
#define N 3000005
int tw[N],a[N],ans[N],top[N],fa[N],n;
int find(int u) {return fa[u]==u?u:fa[u]=find(fa[u]);}
vector<int> G[N];
void work()
{
	n=read();
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++) fa[i]=i,ans[i]=tw[i]=1;
	int lstlen=0;
	for(int t=n;t>=1;)
	{
		for(int j=a[t];j<=t;j++) top[j]=a[t];
		// i=a[i]-1;
		int i=a[t],j=i+1,k=i;
		if(a[i]!=i)
		{
			cout<<"-1\n";
			return ;
		}
		while(j<=t)
		{
			if(a[j]==i)
			{
				// ans[j]=ans[k]+1;
				k=i;
				j++;
			}
			else if(a[j]==a[k]+(j-k))
			{
				// ans[j]=ans[k];
				fa[find(j)]=find(k);
				k++;
				j++;
			}
			else
			{
				cout<<"-1\n";
				return ;
			}
		}
		int addpos=-1;
		int ok=0;
		i=a[t],j=i+1,k=i;
		if(t!=n)
		{
			ans[i]=max(ans[i],ans[t+1]);
		}
		while(j<=t)
		{
			if(a[j]==i)
			{
				ans[find(j)]=max(ans[find(j)],ans[find(k)]+1);
				if(!ok)
				{
					if(t+j-a[t]+1<=n&&top[t+j-a[t]+1]==t+1) ans[find(j)]=max(ans[find(j)],ans[find(t+j-a[t]+1)]);
				}
				if(t+j-a[t]+1<=n&&top[t+j-a[t]+1]==t+1)
				{
					if(ans[find(j)]>ans[find(t+j-a[t]+1)]) ok=1;
				}
				else ok=1;
				k=i;
				j++;
			}
			else if(a[j]==a[k]+(j-k))
			{
				// ans[j]=ans[k];
				// fa[find(j)]=find(k);
				if(!ok)
				{
					if(t+j-a[t]+1<=n&&top[t+j-a[t]+1]==t+1)
					{
						if(ans[find(t+j-a[t]+1)]>ans[find(j)])
						{
							for(int c=j;c>=a[t];c--) if(find(c)==c)
							{
								addpos=c;
								break;
							}
							ok=1;
							break;
						}
					}
				}
				if(t+j-a[t]+1<=n&&top[t+j-a[t]+1]==t+1)
				{
					if(ans[find(j)]>ans[find(t+j-a[t]+1)]) ok=1;
				}
				else ok=1;
				k++;
				j++;
			}
		}
		if(ok==0&&t-a[t]+1<lstlen)
		{
			for(int c=t;c>=a[t];c--)
			{
				if(find(c)==c)
				{
					addpos=c;
					break;
				}
			}
		}
		if(addpos!=-1)
		{
			for(int c=a[t];c<=t;c++) ans[c]=1;
			int ok=0;
			i=a[t],j=i+1,k=i;
			if(t!=n)
			{
				ans[i]=max(ans[i],ans[t+1]);
			}
			if(addpos==i) ans[i]++;
			if(t==n||ans[i]>ans[t+1]) ok=1;
			while(j<=t)
			{
				if(a[j]==i)
				{
					ans[find(j)]=max(ans[find(j)],ans[find(k)]+1);
					if(!ok)
					{
						if(t+j-a[t]+1<=n&&top[t+j-a[t]+1]==t+1) ans[find(j)]=max(ans[find(j)],ans[find(t+j-a[t]+1)]);
					}
					if(j==addpos) ans[j]++;
					if(t+j-a[t]+1<=n&&top[t+j-a[t]+1]==t+1)
					{
						if(ans[find(j)]>ans[find(t+j-a[t]+1)]) ok=1;
					}
					else ok=1;
					k=i;
					j++;
				}
				else if(a[j]==a[k]+(j-k))
				{
					// ans[j]=ans[k];
					// fa[find(j)]=find(k);
					if(j==addpos) ans[j]++;
					if(t+j-a[t]+1<=n&&top[t+j-a[t]+1]==t+1)
					{
						if(ans[find(j)]>ans[find(t+j-a[t]+1)]) ok=1;
					}
					else ok=1;
					k++;
					j++;
				}
			}
		}
		lstlen=t-a[t]+1;
		t=a[t]-1;
	}
	// for(int i=1;i<=n;i++) printf("%d%c",top[i]," \n"[i==n]);
	for(int i=1;i<=n;i++) printf("%d%c",ans[find(i)]," \n"[i==n]);
}
signed main()
{
	int T=read(); while(T--) work();
	return 0;
}



Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 17ms
memory: 73796kb

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: 28ms
memory: 73908kb

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: 16ms
memory: 74024kb

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: 12ms
memory: 73840kb

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: 8ms
memory: 74024kb

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: 15ms
memory: 74012kb

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: 21ms
memory: 73976kb

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: 12ms
memory: 73840kb

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: 27ms
memory: 73796kb

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: 18ms
memory: 74036kb

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: 44ms
memory: 73812kb

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: 53ms
memory: 74024kb

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: 16ms
memory: 73804kb

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: 34ms
memory: 74020kb

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: 36ms
memory: 73852kb

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: 33ms
memory: 74036kb

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: 31ms
memory: 73920kb

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: 37ms
memory: 74024kb

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: 52ms
memory: 73980kb

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: 57ms
memory: 73836kb

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: 40ms
memory: 73896kb

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: 111ms
memory: 73792kb

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: 127ms
memory: 73852kb

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

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: 118ms
memory: 73796kb

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: 108ms
memory: 73996kb

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: 108ms
memory: 74036kb

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

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: 119ms
memory: 74024kb

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: 129ms
memory: 73908kb

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: 127ms
memory: 73912kb

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: 108ms
memory: 73904kb

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: 100ms
memory: 73984kb

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: 108ms
memory: 73908kb

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

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

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: 119ms
memory: 74036kb

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: 116ms
memory: 74036kb

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: 341ms
memory: 112124kb

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: 302ms
memory: 74368kb

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: 333ms
memory: 120280kb

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: 333ms
memory: 117004kb

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: 358ms
memory: 119332kb

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: 346ms
memory: 106996kb

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: 293ms
memory: 112428kb

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: 348ms
memory: 98252kb

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: 362ms
memory: 126412kb

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: 339ms
memory: 128976kb

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: 336ms
memory: 126408kb

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: 354ms
memory: 117656kb

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: 301ms
memory: 100980kb

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: 308ms
memory: 113688kb

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: 336ms
memory: 90964kb

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: 308ms
memory: 92168kb

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: 338ms
memory: 106588kb

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: 324ms
memory: 108932kb

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: 305ms
memory: 94968kb

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: 321ms
memory: 101316kb

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: 325ms
memory: 103700kb

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: 348ms
memory: 124160kb

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: 361ms
memory: 126272kb

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: 274ms
memory: 108436kb

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: 345ms
memory: 110708kb

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: 319ms
memory: 96300kb

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: 301ms
memory: 79636kb

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: 303ms
memory: 102060kb

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: 371ms
memory: 117832kb

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: 339ms
memory: 113072kb

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: 292ms
memory: 115260kb

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: 310ms
memory: 98484kb

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: 319ms
memory: 94460kb

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: 338ms
memory: 120160kb

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: 334ms
memory: 102272kb

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: 322ms
memory: 112956kb

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: 345ms
memory: 109928kb

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: 352ms
memory: 114380kb

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: 304ms
memory: 109416kb

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: 358ms
memory: 124632kb

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: 320ms
memory: 106864kb

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: 339ms
memory: 117144kb

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: 303ms
memory: 91212kb

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: 345ms
memory: 132032kb

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: 334ms
memory: 113908kb

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: 296ms
memory: 96232kb

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: 349ms
memory: 106464kb

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: 318ms
memory: 100552kb

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: 339ms
memory: 121120kb

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: 347ms
memory: 116220kb

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: 348ms
memory: 132440kb

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