QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#691384#5305. Oscar is All You NeedFreeTimeLoveAC ✓2ms3972kbC++142.5kb2024-10-31 11:15:452024-10-31 11:15:45

Judging History

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

  • [2024-10-31 11:15:45]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3972kb
  • [2024-10-31 11:15:45]
  • 提交

answer

/*FreeTimeLove's code.
Love has a nasty habit of disappearing over night.*/
#include<bits/stdc++.h>
namespace FRTMLV{
#define ll long long
#define LD long double
#define i7 __int128
#define re return
#define con continue
using namespace std;
template<class T>inline bool ckmin(T &a,T b){re b<a?a=b,1:0;}
template<class T>inline bool ckmax(T &a,T b){re a<b?a=b,1:0;}
const int N=1e3+5;
inline int rd(){
	int ans=0,f=0;
	char ch=getchar();
	while(ch<'0'||ch>'9')f^=(ch=='-'),ch=getchar();
	while(ch>='0'&&ch<='9')ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
	re f?-ans:ans;
}
int n,siz[N],S[5];
struct xxs{
	int k,s;
}a[N],b[N];
vector<pair<int,int> >Ans;
inline int gtp(int x){
	for(int i=1;i;i++)
		if(a[i].k==x)re i;
	re -1;
}
void add(int l,int r,int len){
	if(l<=0||r<=0)exit(1);
	int ls=0,rs=0;
	for(int i=1;i<=r;i++)b[i]=a[len-r+i],rs+=b[i].s;
	for(int i=1;i<=len-l-r;i++)b[i+r]=a[i+l];
	for(int i=1;i<=l;i++)b[len-l+i]=a[i],ls+=a[i].s;
	Ans.push_back(make_pair(ls,rs));
	memcpy(a,b,sizeof a[0]*(len+1));
}
void ud(int len){
	int K=-1,cnt=0;
	for(int i=1;i<len;i++)
		if(a[i].k+1==a[i+1].k){
			K=a[i].k;
			a[i].s+=a[i+1].s;
			break;
		}
	memcpy(b,a,sizeof b);
	for(int i=1;i<=len;i++)
		if(b[i].k==K+1)con;
		else a[++cnt]={b[i].k-(b[i].k>K),b[i].s};
	if(cnt!=len-1)exit(2);
}
bool dfs(int x1,int x2,int x3,int x4,int d){
	if(x1==a[1].k&&x2==a[2].k&&x3==a[3].k&&x4==a[4].k)re 1;
	if(d>=6)re 0;
	if(dfs(x4,x2,x3,x1,d+1)){
		add(1,1,4);
		re 1;
	}
	if(dfs(x4,x3,x1,x2,d+1)){
		add(1,2,4);
		re 1;
	}
	if(dfs(x3,x4,x2,x1,d+1)){
		add(2,1,4);
		re 1; 
	}
	re 0;
}
int main(){
	int T=rd();
	while(T--){
		n=rd();
		for(int i=1;i<=n;i++)a[i]={rd(),1};
		if(n==3){
			if(a[1].k<a[3].k)puts("0");
			else puts("1\n1 1");
			con;
		}
		Ans.clear();
		int p;
		for(int i=n;i>4;i--){
			if(a[1].k>a[i].k){
				p=gtp(a[i].k+1);
				if(p>1){
					add(p-1,i-p,i);
				}
				else{//k+1...k
					add(1,1,i);
					p=a[1].k==1?gtp(a[i].k+1):gtp(a[1].k-1);
					add(p-1,i-p,i);
				}
			}
			else{
				if(a[i].k<i){//?...k(<i)
					p=gtp(a[i].k+1);
					add(p-1,i-p,i);
				}
				else{//?...i
					if(a[1].k==1)add(1,1,i),p=gtp(2);
					else p=gtp(a[1].k-1);
					add(p-1,i-p,i);
				}
			}
			ud(i);
		}
		for(int i=1;i<=4;i++)S[a[i].k]=a[i].s;
		if(!dfs(1,2,3,4,0))re 114;
		printf("%d\n",(int)Ans.size());
		for(auto x:Ans)printf("%d %d\n",x.first,x.second);
	}
	re 0;
}
/*

*/
}int main(){re FRTMLV::main();}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
3
1 3 2
5
4 1 2 3 5

output:

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

result:

ok OK in maximum 6 operations

Test #2:

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

input:

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

output:

0
1
1 1
1
1 1
8
1 1
1 3
3 1
1 1
1 1
1 1
1 1
1 1
14
5 6
2 9
6 5
9 1
3 8
7 4
7 4
3 7
9 1
1 4
4 6
5 6
2 5
5 2
41
20 15
21 14
12 23
8 27
33 2
1 33
10 25
13 22
24 11
22 12
21 14
20 15
20 15
28 7
5 28
19 15
3 2
5 27
9 25
31 2
6 29
7 28
18 16
18 16
12 21
3 2
23 12
15 19
30 3
27 6
20 14
4 5
5 30
26 6
10 25
...

result:

ok OK in maximum 1 operations

Test #3:

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

input:

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

output:

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

result:

ok OK in maximum 0 operations

Test #4:

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

input:

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

output:

0
1
1 1
0
1
1 1
0
1
1 1

result:

ok OK in maximum 1 operations

Test #5:

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

input:

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

output:

5
2 1
1 1
1 2
1 2
1 1
6
1 2
1 1
2 1
1 1
1 1
1 1
6
2 1
1 1
1 2
1 1
1 1
1 1
6
2 1
1 1
1 1
1 1
1 1
1 1
5
1 1
1 2
1 1
1 1
1 1
5
1 2
1 1
2 1
1 1
1 1
5
1 2
1 2
1 1
1 1
1 1
6
1 1
1 2
1 2
1 1
1 1
1 1
6
2 1
1 1
1 2
1 2
1 1
1 1
6
1 2
1 2
1 1
1 1
1 1
1 1
6
1 2
1 1
2 1
1 1
1 2
1 1
6
1 1
1 2
1 1
1 1
1 1
1 1
0
5
...

result:

ok OK in maximum 6 operations

Test #6:

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

input:

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

output:

6
1 3
1 3
2 1
2 2
2 1
1 2
7
1 3
2 1
1 1
1 2
1 1
1 1
1 1
6
1 3
1 3
2 1
1 2
2 1
1 2
8
1 1
2 2
1 1
2 1
1 1
1 2
1 1
1 1
6
2 2
1 1
3 1
1 2
2 2
1 2
7
3 1
3 1
1 2
2 2
1 2
2 1
1 2
7
2 2
1 1
3 1
1 2
2 2
1 2
2 1
7
1 3
1 1
2 1
1 1
1 2
1 1
1 1
7
3 1
2 2
1 2
3 1
1 1
1 1
1 1
8
1 1
2 2
1 3
2 1
2 2
2 1
1 3
1 1
2
2 ...

result:

ok OK in maximum 6 operations

Test #7:

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

input:

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

output:

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

result:

ok OK in maximum 6 operations

Test #8:

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

input:

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

output:

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

result:

ok OK in maximum 6 operations

Test #9:

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

input:

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

output:

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

result:

ok OK in maximum 10 operations

Test #10:

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

input:

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

output:

8
1 1
2 2
1 3
2 1
2 2
2 1
1 3
1 1
9
1 5
4 2
5 1
2 4
2 2
4 2
2 2
2 4
2 2
9
1 1
1 4
3 2
3 2
1 4
1 1
1 1
1 1
1 1
8
2 3
1 4
3 1
2 3
3 1
1 3
3 1
1 3
0
6
3 1
2 1
1 3
1 1
1 1
1 1
1
1 1
10
1 5
3 3
3 1
2 4
4 1
1 3
3 2
1 5
2 1
1 2
9
1 1
3 2
2 2
4 1
1 3
3 2
1 4
1 1
1 1
2
2 2
2 1
10
1 5
1 1
4 1
3 3
1 5
1 1
5 1
...

result:

ok OK in maximum 8 operations

Test #11:

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

input:

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

output:

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

result:

ok OK in maximum 9 operations

Test #12:

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

input:

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

output:

7
2 2
1 1
3 1
1 2
2 1
1 2
2 1
11
7 1
3 5
6 1
6 2
2 6
6 2
2 2
2 2
2 2
2 2
2 2
10
5 2
5 2
1 5
3 4
5 2
2 4
4 3
1 4
4 1
1 4
8
1 4
1 1
2 3
2 3
2 2
3 2
2 1
1 2
5
1 1
2 1
1 1
1 1
1 1
0
0
7
1 1
1 7
6 2
3 5
1 5
2 5
1 2
0
10
3 4
5 2
5 2
6 1
2 1
1 4
2 4
3 2
2 3
3 2
10
3 3
4 2
1 2
4 2
1 2
3 1
1 1
1 3
2 1
1 2
8
...

result:

ok OK in maximum 1 operations

Test #13:

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

input:

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

output:

10
4 3
4 3
1 6
3 2
1 3
2 1
2 2
2 1
1 3
1 1
10
3 5
2 6
5 2
7 1
6 2
3 3
3 4
1 5
2 1
1 2
0
0
13
5 4
6 3
6 3
8 1
2 2
3 4
1 1
4 1
7 2
2 1
1 8
6 1
1 6
10
1 6
1 6
1 6
1 5
4 1
2 4
4 1
1 4
4 1
1 4
0
7
1 3
3 1
1 2
2 1
1 2
2 1
1 2
1
1 1
9
4 2
5 1
2 4
2 4
2 3
1 2
2 1
1 2
2 1
9
1 1
1 4
3 2
1 3
1 3
2 1
1 2
2 1
1 ...

result:

ok OK in maximum 0 operations

Test #14:

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

input:

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

output:

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

result:

ok OK in maximum 0 operations

Test #15:

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

input:

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

output:

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

result:

ok OK in maximum 8 operations

Test #16:

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

input:

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

output:

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

result:

ok OK in maximum 18 operations

Test #17:

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

input:

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

output:

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

result:

ok OK in maximum 10 operations

Test #18:

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

input:

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

output:

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

result:

ok OK in maximum 18 operations

Test #19:

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

input:

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

output:

998
1 1
1 998
998 1
1 996
996 1
1 994
994 1
1 992
992 1
1 990
990 1
1 988
988 1
1 986
986 1
1 984
984 1
1 982
982 1
1 980
980 1
1 978
978 1
1 976
976 1
1 974
974 1
1 972
972 1
1 970
970 1
1 968
968 1
1 966
966 1
1 964
964 1
1 962
962 1
1 960
960 1
1 958
958 1
1 956
956 1
1 954
954 1
1 952
952 1
1 95...

result:

ok OK in maximum 998 operations

Test #20:

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

input:

1
1000
1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 ...

output:

1001
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
9...

result:

ok OK in maximum 1001 operations

Test #21:

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

input:

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

output:

998
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
99...

result:

ok OK in maximum 998 operations

Test #22:

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

input:

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

output:

1002
2 997
1 1
2 996
996 2
2 994
994 2
2 992
992 2
2 990
990 2
2 988
988 2
2 986
986 2
2 984
984 2
2 982
982 2
2 980
980 2
2 978
978 2
2 976
976 2
2 974
974 2
2 972
972 2
2 970
970 2
2 968
968 2
2 966
966 2
2 964
964 2
2 962
962 2
2 960
960 2
2 958
958 2
2 956
956 2
2 954
954 2
2 952
952 2
2 950
950...

result:

ok OK in maximum 1002 operations

Test #23:

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

input:

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

output:

1001
2 996
1 1
2 995
995 2
2 993
993 2
2 991
991 2
2 989
989 2
2 987
987 2
2 985
985 2
2 983
983 2
2 981
981 2
2 979
979 2
2 977
977 2
2 975
975 2
2 973
973 2
2 971
971 2
2 969
969 2
2 967
967 2
2 965
965 2
2 963
963 2
2 961
961 2
2 959
959 2
2 957
957 2
2 955
955 2
2 953
953 2
2 951
951 2
2 949
949...

result:

ok OK in maximum 1001 operations

Test #24:

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

input:

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

output:

1002
1 1
1 997
997 1
1 995
995 1
1 993
993 1
1 991
991 1
1 989
989 1
1 987
987 1
1 985
985 1
1 983
983 1
1 981
981 1
1 979
979 1
1 977
977 1
1 975
975 1
1 973
973 1
1 971
971 1
1 969
969 1
1 967
967 1
1 965
965 1
1 963
963 1
1 961
961 1
1 959
959 1
1 957
957 1
1 955
955 1
1 953
953 1
1 951
951 1
1 9...

result:

ok OK in maximum 1002 operations

Test #25:

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

input:

1
999
999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 92...

output:

1001
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
9...

result:

ok OK in maximum 1001 operations

Test #26:

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

input:

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

output:

998
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 ...

result:

ok OK in maximum 998 operations

Test #27:

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

input:

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

output:

996
1 1
1 996
996 1
1 994
994 1
1 992
992 1
1 990
990 1
1 988
988 1
1 986
986 1
1 984
984 1
1 982
982 1
1 980
980 1
1 978
978 1
1 976
976 1
1 974
974 1
1 972
972 1
1 970
970 1
1 968
968 1
1 966
966 1
1 964
964 1
1 962
962 1
1 960
960 1
1 958
958 1
1 956
956 1
1 954
954 1
1 952
952 1
1 950
950 1
1 94...

result:

ok OK in maximum 996 operations

Test #28:

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

input:

1
998
998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 92...

output:

999
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
99...

result:

ok OK in maximum 999 operations

Test #29:

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

input:

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

output:

1001
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
9...

result:

ok OK in maximum 1001 operations

Test #30:

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

input:

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

output:

1000
1 1
1 995
995 1
1 993
993 1
1 991
991 1
1 989
989 1
1 987
987 1
1 985
985 1
1 983
983 1
1 981
981 1
1 979
979 1
1 977
977 1
1 975
975 1
1 973
973 1
1 971
971 1
1 969
969 1
1 967
967 1
1 965
965 1
1 963
963 1
1 961
961 1
1 959
959 1
1 957
957 1
1 955
955 1
1 953
953 1
1 951
951 1
1 949
949 1
1 9...

result:

ok OK in maximum 1000 operations

Test #31:

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

input:

1
997
997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 92...

output:

998
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
99...

result:

ok OK in maximum 998 operations

Test #32:

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

input:

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

output:

1001
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1...

result:

ok OK in maximum 1001 operations

Test #33:

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

input:

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

output:

1159
1 1
1 998
998 1
1 996
996 1
1 994
994 1
1 992
992 1
1 990
990 1
1 988
988 1
1 986
986 1
1 984
984 1
1 982
982 1
1 980
980 1
1 978
978 1
1 976
976 1
1 974
974 1
1 972
972 1
1 970
970 1
1 968
968 1
1 966
966 1
1 964
964 1
1 962
962 1
1 960
960 1
1 958
958 1
1 956
956 1
1 954
954 1
1 952
952 1
1 9...

result:

ok OK in maximum 1159 operations

Test #34:

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

input:

1
1000
1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 ...

output:

1001
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
9...

result:

ok OK in maximum 1001 operations

Test #35:

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

input:

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

output:

1228
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
780 219
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1
998 1...

result:

ok OK in maximum 1228 operations

Test #36:

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

input:

1
1000
999 1 998 2 1000 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 673 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...

output:

1105
2 997
1 1
2 996
996 2
2 994
994 2
2 992
992 2
2 990
990 2
2 988
988 2
2 986
986 2
2 984
984 2
2 982
982 2
2 980
980 2
2 978
978 2
2 976
976 2
2 974
974 2
2 972
972 2
2 970
970 2
2 968
968 2
2 967
638 361
361 638
638 361
361 638
638 361
361 638
638 361
361 638
638 361
361 638
638 361
361 638
638...

result:

ok OK in maximum 1105 operations

Test #37:

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

input:

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

output:

1005
2 997
1 1
2 996
996 2
2 994
994 2
2 992
992 2
2 990
990 2
2 988
988 2
2 986
986 2
2 984
984 2
2 982
982 2
2 980
980 2
2 978
978 2
2 976
976 2
2 974
974 2
2 972
972 2
2 970
970 2
2 968
968 2
2 966
966 2
2 964
964 2
2 962
962 2
2 960
960 2
2 958
958 2
2 956
956 2
2 954
954 2
2 952
952 2
2 950
950...

result:

ok OK in maximum 1005 operations

Test #38:

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

input:

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

output:

1213
1 1
1 997
997 1
1 995
995 1
1 993
993 1
1 991
991 1
1 989
989 1
1 987
987 1
1 985
985 1
1 983
983 1
1 981
981 1
1 979
979 1
1 977
977 1
1 975
975 1
1 973
973 1
1 971
971 1
1 969
969 1
1 967
967 1
1 965
965 1
1 963
963 1
1 961
961 1
1 959
959 1
1 957
957 1
1 955
955 1
1 953
953 1
1 951
951 1
1 9...

result:

ok OK in maximum 1213 operations

Test #39:

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

input:

1
999
999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 92...

output:

1000
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
997 1
9...

result:

ok OK in maximum 1000 operations

Test #40:

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

input:

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

output:

1005
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1 997
1...

result:

ok OK in maximum 1005 operations

Test #41:

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

input:

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

output:

1101
1 1
1 996
996 1
1 994
994 1
1 992
992 1
1 990
990 1
1 988
988 1
1 986
986 1
1 984
984 1
1 982
982 1
1 980
980 1
1 978
978 1
1 976
976 1
1 974
974 1
1 972
972 1
1 970
970 1
1 968
968 1
1 966
966 1
1 964
964 1
1 962
962 1
1 960
960 1
1 958
958 1
1 956
956 1
1 954
954 1
1 952
952 1
1 950
950 1
1 9...

result:

ok OK in maximum 1101 operations

Test #42:

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

input:

1
998
998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 92...

output:

1000
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
350 647
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1...

result:

ok OK in maximum 1000 operations

Test #43:

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

input:

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

output:

1214
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
996 1
901 96
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
1 996
...

result:

ok OK in maximum 1214 operations

Test #44:

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

input:

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

output:

1248
1 1
1 995
995 1
1 993
993 1
1 991
991 1
1 989
989 1
1 987
987 1
1 985
985 1
1 983
983 1
1 981
981 1
1 979
979 1
1 977
977 1
1 975
975 1
1 973
973 1
1 971
971 1
1 969
969 1
1 967
967 1
1 965
965 1
1 963
963 1
1 961
961 1
1 959
959 1
1 957
957 1
1 955
955 1
1 953
953 1
1 951
951 1
1 949
949 1
1 9...

result:

ok OK in maximum 1248 operations

Test #45:

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

input:

1
997
997 996 995 994 993 992 991 990 989 988 987 986 176 984 983 982 981 980 979 978 977 976 975 974 973 756 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 92...

output:

1000
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
995 1
9...

result:

ok OK in maximum 1000 operations

Test #46:

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

input:

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

output:

1018
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1 995
1...

result:

ok OK in maximum 1018 operations

Test #47:

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

input:

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

output:

995
1 1
1 784
784 1
1 782
782 1
1 780
780 1
1 778
778 1
1 776
776 1
1 774
774 1
1 772
772 1
1 770
770 1
1 769
169 616
616 169
169 616
616 169
169 616
616 169
169 616
616 169
169 616
616 169
169 616
616 169
169 616
616 169
169 616
616 169
169 616
616 169
169 616
616 169
169 616
616 169
169 616
616 16...

result:

ok OK in maximum 995 operations

Test #48:

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

input:

1
979
979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 81 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 900 932 931 930 929 928 927 926 925 924 923 509 921 920 919 918 917 916 915 914 913 912 911 910 909 908 907 906...

output:

981
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
374 604
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
977 1
...

result:

ok OK in maximum 981 operations

Test #49:

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

input:

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

output:

924
796 1
796 1
796 1
508 289
169 628
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
450 347
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
796 1
713 84
1 796
1 796
1 796
1 796
1 796
1 796
1 796
1 796
1 796
1 796
1 796
1...

result:

ok OK in maximum 924 operations

Test #50:

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

input:

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

output:

1131
1 1
1 995
995 1
1 993
993 1
1 991
991 1
1 989
989 1
1 987
987 1
1 985
985 1
1 983
983 1
1 981
981 1
1 979
979 1
1 977
977 1
1 975
975 1
1 973
973 1
1 971
971 1
1 969
969 1
1 967
967 1
1 965
965 1
1 963
963 1
1 961
961 1
1 959
959 1
1 957
957 1
1 955
955 1
1 953
953 1
1 951
951 1
1 949
949 1
1 9...

result:

ok OK in maximum 1131 operations

Test #51:

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

input:

1
876
876 875 874 873 872 871 870 402 868 867 866 865 864 863 862 861 860 859 858 857 856 855 854 853 852 851 850 849 848 847 846 845 844 843 842 841 840 839 838 837 836 835 834 833 832 831 830 829 828 827 826 825 824 823 822 821 820 819 818 817 816 815 814 813 812 811 810 809 808 807 806 805 804 80...

output:

878
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
500 375
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
874 1
786 89
874 1
874 1...

result:

ok OK in maximum 878 operations

Test #52:

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

input:

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

output:

1094
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
1 989
284 706
989 1
989 1
989 1
989 1
989 1
989 1
989 1
989 1
989 1
989 1
989 1
989 1
989 1
989 1...

result:

ok OK in maximum 1094 operations

Test #53:

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

input:

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

output:

1339
1 1
1 992
992 1
1 990
990 1
1 988
988 1
1 986
986 1
1 984
984 1
1 982
982 1
1 980
980 1
1 978
978 1
1 976
976 1
1 974
974 1
1 972
972 1
1 970
970 1
1 968
968 1
1 966
966 1
1 964
964 1
1 962
962 1
1 960
960 1
1 958
958 1
1 956
956 1
1 954
954 1
1 952
952 1
1 950
950 1
1 948
948 1
1 946
946 1
1 9...

result:

ok OK in maximum 1339 operations

Test #54:

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

input:

1
989
989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 924 923 922 921 920 919 918 917 91...

output:

990
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
987 1
98...

result:

ok OK in maximum 990 operations

Test #55:

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

input:

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

output:

1180
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1 993
1...

result:

ok OK in maximum 1180 operations

Test #56:

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

input:

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

output:

795
1 1
1 777
777 1
1 775
775 1
1 773
773 1
1 771
771 1
1 769
769 1
1 767
767 1
1 765
765 1
1 763
763 1
1 761
761 1
1 759
759 1
1 757
757 1
1 755
755 1
1 753
753 1
1 751
751 1
1 749
749 1
1 747
747 1
1 745
745 1
1 743
743 1
1 741
741 1
1 739
739 1
1 737
737 1
1 735
735 1
1 733
733 1
1 731
731 1
1 72...

result:

ok OK in maximum 795 operations

Test #57:

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

input:

1
797
797 796 795 794 793 792 791 790 789 788 787 786 785 784 783 782 781 780 779 778 777 776 775 774 773 772 771 770 769 768 767 766 765 764 763 762 761 760 759 758 757 756 755 754 753 752 751 750 749 748 747 746 745 744 743 742 741 740 739 738 737 736 735 734 733 732 731 730 729 180 727 726 725 72...

output:

798
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
528 268
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
795 1
...

result:

ok OK in maximum 798 operations

Test #58:

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

input:

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

output:

788
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
612 53
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
664 1
6...

result:

ok OK in maximum 788 operations

Test #59:

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

input:

1
1000
578 309 830 993 658 748 234 814 841 592 32 353 750 217 807 478 970 442 676 274 850 638 367 776 63 165 649 945 475 773 528 491 986 918 68 966 448 992 879 503 364 564 290 675 47 586 891 954 5 982 305 628 34 881 593 130 409 431 824 757 931 948 751 188 434 69 19 190 825 855 253 732 663 65 133 835...

output:

1006
743 256
379 620
984 15
989 10
144 855
403 596
314 685
4 995
413 586
678 321
30 969
920 79
552 447
70 929
807 192
197 802
741 257
929 70
741 258
653 346
226 773
13 986
333 666
432 567
696 303
42 957
867 132
339 660
476 523
991 8
602 397
980 19
745 254
332 667
371 628
385 614
723 276
133 866
306 ...

result:

ok OK in maximum 1006 operations

Test #60:

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

input:

1
999
587 632 199 969 304 657 430 733 692 680 378 704 506 884 832 959 150 898 242 641 968 818 77 584 806 529 74 29 338 205 555 410 72 82 964 487 774 111 765 625 835 580 992 437 65 602 958 517 800 637 795 128 350 626 450 694 262 812 287 289 468 603 432 561 942 827 714 101 54 996 656 874 681 932 718 2...

output:

1008
44 954
724 274
710 288
312 686
463 535
258 740
582 416
125 873
211 787
543 455
138 860
726 272
704 294
92 906
338 660
264 734
134 864
258 740
551 447
197 801
159 839
591 407
501 497
591 407
991 7
118 880
536 462
223 775
225 773
64 934
893 105
353 645
651 347
615 383
149 849
514 484
235 763
694 ...

result:

ok OK in maximum 1008 operations

Test #61:

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

input:

1
1000
942 663 980 943 478 437 896 721 40 616 613 423 487 344 424 269 639 813 335 35 359 2 115 701 366 940 495 545 879 42 296 826 370 859 599 861 996 530 459 724 412 622 136 548 918 171 160 343 547 14 658 807 681 636 448 928 132 893 982 227 388 757 543 814 985 585 742 301 815 897 831 298 950 925 758...

output:

1011
925 74
30 969
501 498
76 923
987 12
814 185
372 627
761 238
447 552
657 342
514 485
86 913
895 104
735 264
183 816
803 196
296 703
781 218
694 305
920 79
596 403
299 700
904 95
702 297
18 981
473 526
641 358
493 506
412 587
138 861
182 817
170 828
417 582
813 186
487 512
603 396
381 618
362 637...

result:

ok OK in maximum 1011 operations

Test #62:

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

input:

1
999
113 438 987 12 663 156 157 317 757 698 170 134 491 495 80 899 426 750 437 979 938 121 199 210 399 96 76 286 855 47 242 416 728 352 271 562 203 755 116 981 643 161 816 840 49 385 681 331 306 179 50 213 695 929 628 807 952 884 349 34 43 92 326 639 850 474 104 806 963 737 898 45 409 629 809 20 95...

output:

1013
738 260
434 564
228 770
663 335
514 484
18 980
887 111
475 523
772 225
528 470
25 973
800 198
887 111
264 734
866 132
121 877
926 72
787 211
146 852
453 545
582 416
536 462
244 754
702 296
750 248
430 568
166 832
135 863
364 634
310 688
374 624
553 445
190 808
449 549
214 784
557 441
204 794
14...

result:

ok OK in maximum 1013 operations

Test #63:

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

input:

1
1000
546 417 781 732 488 684 86 603 677 529 678 253 756 307 819 476 757 899 838 976 755 246 418 55 904 512 727 440 960 642 969 294 163 434 873 317 87 91 329 840 243 459 522 959 694 689 278 620 472 591 766 54 425 147 128 213 315 95 267 365 825 295 533 900 380 502 291 862 788 872 938 800 21 419 995 ...

output:

1007
8 991
596 403
895 104
565 434
165 834
235 764
488 511
860 139
67 932
349 650
342 657
448 551
548 451
748 251
429 570
560 439
980 19
910 89
803 196
880 119
10 989
80 919
280 719
959 40
13 985
506 493
355 644
668 331
452 547
414 585
861 138
456 543
909 90
106 893
12 986
499 500
987 12
987 12
591 ...

result:

ok OK in maximum 1007 operations

Test #64:

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

input:

1
999
774 166 908 231 496 472 465 16 102 978 49 570 597 411 168 299 378 561 429 668 676 250 362 784 840 650 326 370 377 548 134 845 183 793 809 934 928 980 619 404 331 173 256 644 382 901 426 232 200 144 780 617 743 609 431 17 520 24 425 794 334 450 786 135 280 490 245 236 215 25 380 719 155 126 471...

output:

1005
598 400
894 104
267 731
926 72
495 503
562 436
955 43
970 28
731 267
850 148
836 162
833 165
46 952
564 434
200 798
229 769
951 47
299 699
273 725
3 995
382 616
287 711
813 185
591 407
921 76
537 461
283 715
227 771
89 909
21 977
191 807
701 297
616 382
638 360
790 208
366 631
851 147
605 393
6...

result:

ok OK in maximum 1005 operations

Test #65:

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

input:

1
1000
766 935 587 770 502 232 760 629 561 481 89 664 571 241 87 326 708 605 79 721 871 752 669 555 123 990 269 400 583 290 594 346 933 719 859 830 181 510 61 658 706 399 911 411 778 948 306 707 781 47 740 434 645 18 944 847 668 336 886 811 548 155 599 404 461 278 211 589 884 672 785 989 941 17 260 ...

output:

1006
698 301
392 607
23 976
145 854
758 241
685 314
872 127
755 244
387 612
745 254
714 285
464 535
154 845
667 332
887 112
211 788
729 270
111 888
485 514
876 123
652 347
819 180
483 516
290 709
304 695
328 671
268 731
624 375
676 323
572 427
161 838
973 26
486 513
682 317
56 943
535 464
650 349
28...

result:

ok OK in maximum 1006 operations

Test #66:

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

input:

1
999
543 320 106 886 488 688 182 305 911 670 598 134 828 201 627 69 124 132 811 768 65 423 281 189 801 599 312 567 999 487 762 764 405 778 898 365 957 743 990 951 516 28 388 477 261 296 464 619 984 227 504 329 391 507 317 612 560 1 557 649 20 376 945 744 881 926 260 322 831 271 781 950 144 262 789 ...

output:

1007
183 815
320 678
492 506
333 665
563 435
36 962
868 130
556 442
220 778
627 371
211 787
386 612
717 281
841 157
141 857
774 224
976 22
86 912
416 582
359 639
49 949
34 964
79 919
862 136
303 695
424 574
17 981
948 50
564 434
759 238
787 211
859 139
391 607
515 483
942 56
96 902
766 232
739 259
9...

result:

ok OK in maximum 1007 operations

Test #67:

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

input:

1
1000
608 358 52 308 498 40 688 621 736 287 525 969 537 769 681 653 309 330 490 385 232 585 472 379 406 704 522 667 291 593 260 206 72 162 443 399 801 230 127 718 421 721 415 471 968 159 110 38 838 587 880 172 281 900 335 144 987 568 119 196 62 299 145 545 864 922 211 635 649 822 793 134 403 640 11...

output:

1009
978 21
243 756
85 914
383 616
390 609
632 367
485 514
534 465
127 872
91 908
349 650
71 928
43 956
519 480
447 552
773 226
365 634
340 659
420 579
668 331
112 887
656 343
250 749
435 564
536 463
39 960
888 111
313 686
923 76
781 218
799 200
953 46
314 685
572 427
997 2
302 697
912 87
854 145
32...

result:

ok OK in maximum 1009 operations

Test #68:

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

input:

1
999
911 432 290 796 764 61 990 509 200 218 304 386 312 204 690 672 655 883 532 365 667 675 457 840 900 842 437 536 766 925 637 287 346 232 523 721 190 770 483 481 908 740 952 954 514 213 700 51 216 16 297 586 593 55 502 240 889 746 472 858 831 423 138 689 89 739 407 972 613 201 914 490 518 340 961...

output:

1004
578 420
190 808
971 27
688 310
908 90
793 205
496 502
213 785
541 457
988 10
726 272
853 145
813 185
584 414
596 402
567 431
250 748
872 126
692 306
902 96
47 951
528 470
970 28
853 145
773 225
547 451
254 744
487 511
9 989
981 17
343 655
654 343
457 541
576 422
219 779
866 132
13 985
840 158
3...

result:

ok OK in maximum 1004 operations

Test #69:

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

input:

1
1000
553 48 915 421 206 713 491 894 864 951 261 512 602 976 136 283 132 380 824 617 955 681 51 514 158 601 900 945 9 534 995 268 33 473 825 54 476 26 999 981 399 223 649 263 167 948 253 679 120 13 734 949 917 609 575 838 646 359 369 312 478 485 802 246 931 680 774 632 286 201 961 723 763 585 724 7...

output:

1009
293 706
776 223
732 267
695 304
700 299
34 965
237 762
571 428
146 853
884 115
1 998
776 223
324 675
354 645
648 351
19 980
309 690
290 709
865 134
123 876
357 642
980 19
891 108
203 796
663 336
182 817
955 44
667 332
621 378
516 483
606 393
610 389
560 439
819 180
961 38
808 191
786 213
493 50...

result:

ok OK in maximum 1009 operations

Test #70:

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

input:

1
999
801 440 924 519 4 420 320 244 674 455 838 164 783 603 676 967 352 407 973 727 29 929 875 970 792 138 152 552 312 978 807 489 61 648 177 717 424 691 186 825 123 454 684 206 944 240 491 873 709 314 582 216 613 479 960 872 214 98 921 209 39 818 403 380 841 327 854 704 548 42 365 371 135 387 640 1...

output:

1005
28 970
158 840
94 904
704 294
494 504
846 152
991 7
959 39
485 513
675 323
83 915
557 441
519 479
290 708
171 827
797 201
426 572
680 318
664 334
703 295
901 97
496 502
605 393
13 985
827 171
738 260
38 960
521 477
684 314
407 591
219 779
526 472
538 460
356 642
95 903
959 39
964 34
957 41
709 ...

result:

ok OK in maximum 1005 operations

Test #71:

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

input:

1
1000
671 474 830 79 544 973 560 315 103 804 954 850 756 890 450 395 773 792 256 407 928 983 682 621 388 378 67 718 243 640 812 4 788 511 230 503 456 150 246 496 454 738 217 411 204 876 305 9 940 290 280 498 849 980 986 327 85 110 285 647 80 552 691 586 479 786 190 293 976 151 188 581 783 311 639 3...

output:

1005
397 602
696 303
527 472
403 596
469 530
245 754
880 118
442 557
48 951
586 413
212 787
371 628
984 15
906 93
55 944
149 850
238 761
149 850
647 352
487 512
876 123
352 647
361 638
662 337
804 195
694 305
899 100
965 34
692 307
500 499
217 782
496 503
328 671
830 169
559 440
325 674
825 174
65 9...

result:

ok OK in maximum 1005 operations

Test #72:

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

input:

1
999
673 776 646 216 614 126 24 515 606 840 979 826 527 349 524 512 679 735 355 972 152 105 772 844 850 784 672 857 775 136 155 761 174 71 798 977 851 628 62 153 892 23 953 97 717 786 237 315 800 869 60 142 802 446 351 299 55 861 852 251 505 900 880 936 482 101 376 236 338 952 653 661 310 503 803 2...

output:

1007
215 783
9 989
599 399
97 901
95 903
747 251
208 790
193 805
931 67
503 495
964 34
473 525
218 780
548 449
71 927
139 859
544 453
734 264
499 499
214 784
686 312
329 669
871 127
406 592
862 136
259 739
596 401
19 979
924 74
40 958
463 535
735 262
440 558
2 996
608 390
130 868
40 958
401 597
4 99...

result:

ok OK in maximum 1007 operations