QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#691661#5305. Oscar is All You NeedFreeTimeLoveAC ✓2ms3992kbC++142.2kb2024-10-31 12:30:362024-10-31 12:30:38

Judging History

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

  • [2024-10-31 12:30:38]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3992kb
  • [2024-10-31 12:30:36]
  • 提交

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){
	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};
}
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+1)add(1,1,i);
			if(a[1].k+1==a[i].k){
				p=a[1].k==1?gtp(a[i].k+1):gtp(a[1].k-1);
				add(p-1,i-p,i);
			}
			else{
				if(a[1].k<a[i].k)add(1,1,i);
				int p=gtp(a[i].k+1);
				add(p-1,i-p,i);
			}
			ud(i);
		}
		for(int i=1;i<=4;i++)S[a[i].k]=a[i].s;
		dfs(1,2,3,4,0);
		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: 3844kb

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

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
6 5
7 3
5 6
6 4
9 2
3 3
1 9
6 1
1 6
6 1
1 6
55
20 15
21 14
1 1
13 21
1 1
10 25
16 19
1 1
22 13
2 1
3 32
1 1
6 29
5 30
21 14
2 1
31 2
5 1
24 11
34 1
32 2
7 28
1 2
28 7
1 1
32 1
6 27
1 1
23 11
21 9
1 34
1 1
32 1
4 1
2 31
1 1
22 13
2 3
29 3...

result:

ok OK in maximum 1 operations

Test #3:

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

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:

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

result:

ok OK in maximum 0 operations

Test #4:

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

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: 1ms
memory: 3820kb

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
6
3 1
1 1
3 1
1 2
2 2
1 2
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
1 1
2 2
3 1
1 1
1 3
2 2
1 2
6
3 1
1 2
1 1
2 1
1 1
1 1
7
1 1
2 2
1 1
3 1
1 2
2 1
1 2
6
2 2
1 3
2 1
2 2
2 1
1 2
8
1 1
2 2
1 3
2 1
2 2
2 1
1 3
1 1
8
1 1
3 1
2 1
1 ...

result:

ok OK in maximum 2 operations

Test #7:

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

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
9
4 2
2 3
1 5
3 1
2 3
3 1
1 3
3 1
1 3
7
1 1
3 1
3 1
1 1
1 3
2 1
1 2
1
1 1
3
1 1
4 1
4 1
11
1 1
4 2
1 1
5 1
1 1
5 1
3 2
2 1
1 2
2 1
1 2
10
3 3
1 1
4 2
2 1
3 2
2 1
4 2
2 3
3 3
1 3
8
4 1
2 1
3 2
3 1
1 4
1 1
1 1
1 1
6
1 1
1 2
1 2
1 1
1 1
1 1
7
1 1
1 3
2 2
2 1
1 3
...

result:

ok OK in maximum 6 operations

Test #8:

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

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
8
1 1
2 2
1 2
1 1
1 1
1 1
1 1
1 1
1
1 1
8
1 1
2 2
2 1
1 1
1 2
1 3
2 1
1 2
8
1 1
2 2
3 1
1 2
2 2
1 2
2 1
1 2
1
1 1
1
1 1
6
1 1
1 2
1 2
1 1
1 1
1 1
9
1 1
2 3
1 1
2 2
1 4
3 1
2 3
3 1
1 3
7
1 1
3 1
2 1
1 3
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 ...

result:

ok OK in maximum 6 operations

Test #9:

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

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
10
1 1
4 1
2 1
3 2
3 1
2 3
3 1
1 3
3 1
1 3
6
1 1
2 1
1 1
1 2
1 1
1 1
0
5
1 1
3 3
5 1
2 1
2 4
0
9
1 1
4 1
3 2
2 1
1 1
1 2
1 4
3 1
1 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
11
1 1
5 1
1 1
5 1
2 1
4 2
3 2
2 4
1 2
2 1
1 2
5
3 3
1 5
1 2
4 2
1 2
7
2 2
...

result:

ok OK in maximum 10 operations

Test #10:

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

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
10
3 3
3 2
1 1
1 3
1 5
1 1
5 1
1 4
4 2
1 4
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
1 1
2 4
5 1
1 4
2 1
3 2
2 2
2 3
1 2
9
1 1
3 2
2 2
4 1
1 3
3 2
1 4
1 1
1 1
8
1 1
3 1
2 1
1 3
1 2
1 1
1 1
1 1
10...

result:

ok OK in maximum 8 operations

Test #11:

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

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:

12
1 1
1 6
5 1
3 1
2 5
6 1
2 4
5 2
2 1
1 6
4 1
1 4
10
5 1
1 1
4 2
3 3
2 3
1 2
2 1
1 2
2 1
1 2
1
1 1
10
1 1
2 3
1 1
2 2
1 2
1 1
2 1
1 1
1 1
1 1
6
1 1
2 1
1 1
1 2
1 1
1 1
10
3 5
5 3
3 4
6 2
1 6
2 6
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
14
4 5
1 1
4 4
7 2
1 1
1 7
6 3
3 2
4 3
3 1
6 3
3 5...

result:

ok OK in maximum 10 operations

Test #12:

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

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
1 1
1 3
1 1
3 1
1 2
2 1
1 2
13
5 3
3 4
7 1
2 1
2 6
4 1
1 6
6 1
1 4
4 1
1 4
4 1
1 4
10
3 4
4 3
2 4
1 1
4 1
5 1
1 1
1 5
4 1
1 4
9
1 1
2 3
1 1
4 1
1 3
2 1
1 2
2 1
1 2
5
1 1
2 1
1 1
1 1
1 1
0
0
14
1 1
1 7
1 1
2 5
4 2
1 1
1 7
4 4
1 7
2 1
6 2
2 5
5 3
1 5
0
10
1 1
5 2
3 4
3 4
2 3
2 5
4 2
3 4
4 1
1 6
10
1...

result:

ok OK in maximum 1 operations

Test #13:

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

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:

11
1 1
1 6
2 5
2 4
3 1
2 4
4 1
1 3
3 2
1 3
3 1
14
1 1
5 3
1 1
4 4
1 7
5 1
4 1
2 5
7 1
1 6
6 2
1 6
6 1
1 6
0
0
16
1 1
8 1
2 1
5 4
1 1
2 5
2 7
5 1
3 6
1 3
1 8
1 1
8 1
1 7
7 2
1 7
11
1 1
3 4
1 6
3 3
2 2
3 3
1 3
2 1
2 2
2 1
1 2
0
7
1 3
3 1
1 2
2 1
1 2
2 1
1 2
1
1 1
8
4 2
5 1
3 2
1 5
4 1
2 4
4 1
1 5
9
1 ...

result:

ok OK in maximum 0 operations

Test #14:

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

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
13
1 1
5 2
1 1
6 1
2 1
2 4
2 1
5 2
2 4
2 2
2 2
2 2
2 2
12
7 1
6 2
1 1
3 5
3 5
6 1
3 3
4 3
3 1
1 6
3 1
1 3
10
3 4
5 2
1 5
3 1
3 3
3 2
1 3
3 1
1 3
3 1
14
1 1
2 7
6 2
4 5
3 6
7 2
1 4
5 2
5 1
1 4
4 2
1 8
4 1
1 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
10
1 1
3 2
1 1
3 2...

result:

ok OK in maximum 0 operations

Test #15:

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

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:

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

result:

ok OK in maximum 7 operations

Test #16:

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

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:

28
1 1
12 4
12 4
1 1
13 3
1 1
11 5
3 13
2 1
3 11
2 1
1 14
12 3
3 1
1 14
1 12
5 1
2 12
3 1
1 12
8 1
2 12
4 2
1 15
11 1
1 11
11 1
1 11
25
1 1
5 10
1 1
4 11
1 2
5 9
3 11
1 1
4 8
6 9
5 1
4 11
11 4
4 10
14 1
2 1
13 2
3 10
11 4
5 1
1 4
4 2
1 14
10 1
1 10
22
8 6
1 1
3 11
12 2
10 4
2 1
11 3
1 1
5 8
1 1
2 11...

result:

ok OK in maximum 22 operations

Test #17:

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

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
12
1 1
5 3
2 5
3 5
3 2
4 4
1 4
3 5
4 3
3 4
4 3
3 4
15
4 6
8 2
8 2
9 1
2 1
8 2
3 1
6 3
5 1
1 9
1 7
6 1
2 6
6 1
1 6
24
6 10
9 7
5 11
2 1
11 5
13 3
5 11
1 1
8 7
10 4
1 1
9 7
3 5
12 4
1 1
13 2
1 3
6 10
10 6
3 10
9 3
4 9
9 1
1 9
19
3 10
1 1
2 11
1 1
2 11
2 11
9 4
9 4
2 1...

result:

ok OK in maximum 15 operations

Test #18:

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

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:

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

result:

ok OK in maximum 21 operations

Test #19:

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

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:

1976
1 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1...

result:

ok OK in maximum 1976 operations

Test #20:

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

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:

1002
998 1
998 1
2 996
995 4
998 1
2 993
992 7
998 1
2 990
989 10
998 1
2 987
986 13
998 1
2 984
983 16
998 1
2 981
980 19
998 1
2 978
977 22
998 1
2 975
974 25
998 1
2 972
971 28
998 1
2 969
968 31
998 1
2 966
965 34
998 1
2 963
962 37
998 1
2 960
959 40
998 1
2 957
956 43
998 1
2 954
953 46
998 1
...

result:

ok OK in maximum 1002 operations

Test #21:

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

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:

1317
1 1
3 996
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 1317 operations

Test #22:

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

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:

1755
2 997
1 1
2 996
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998...

result:

ok OK in maximum 1755 operations

Test #23:

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

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:

1755
2 996
1 1
2 995
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997...

result:

ok OK in maximum 1755 operations

Test #24:

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

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:

1980
1 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1...

result:

ok OK in maximum 1980 operations

Test #25:

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

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
2 995
994 4
997 1
2 992
991 7
997 1
2 989
988 10
997 1
2 986
985 13
997 1
2 983
982 16
997 1
2 980
979 19
997 1
2 977
976 22
997 1
2 974
973 25
997 1
2 971
970 28
997 1
2 968
967 31
997 1
2 965
964 34
997 1
2 962
961 37
997 1
2 959
958 40
997 1
2 956
955 43
997 1
2 953
952 46
997 1
...

result:

ok OK in maximum 1001 operations

Test #26:

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

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:

1316
1 1
3 995
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 1316 operations

Test #27:

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

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:

1976
1 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1...

result:

ok OK in maximum 1976 operations

Test #28:

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

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
2 994
993 4
996 1
2 991
990 7
996 1
2 988
987 10
996 1
2 985
984 13
996 1
2 982
981 16
996 1
2 979
978 19
996 1
2 976
975 22
996 1
2 973
972 25
996 1
2 970
969 28
996 1
2 967
966 31
996 1
2 964
963 34
996 1
2 961
960 37
996 1
2 958
957 40
996 1
2 955
954 43
996 1
2 952
951 46
996 1
2...

result:

ok OK in maximum 999 operations

Test #29:

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

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:

1313
1 1
3 994
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 1313 operations

Test #30:

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:

1972
1 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1...

result:

ok OK in maximum 1972 operations

Test #31:

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

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:

999
995 1
995 1
2 993
992 4
995 1
2 990
989 7
995 1
2 987
986 10
995 1
2 984
983 13
995 1
2 981
980 16
995 1
2 978
977 19
995 1
2 975
974 22
995 1
2 972
971 25
995 1
2 969
968 28
995 1
2 966
965 31
995 1
2 963
962 34
995 1
2 960
959 37
995 1
2 957
956 40
995 1
2 954
953 43
995 1
2 951
950 46
995 1
2...

result:

ok OK in maximum 999 operations

Test #32:

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

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:

1315
1 1
3 993
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 1315 operations

Test #33:

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

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:

1764
1 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1...

result:

ok OK in maximum 1764 operations

Test #34:

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

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:

1165
998 1
998 1
2 996
995 4
998 1
2 993
992 7
998 1
2 990
989 10
998 1
2 987
986 13
998 1
2 984
983 16
998 1
2 981
980 19
998 1
2 978
977 22
998 1
2 975
974 25
998 1
2 972
971 28
998 1
2 969
968 31
998 1
2 966
965 34
998 1
2 963
962 37
998 1
2 960
959 40
998 1
2 957
956 43
998 1
2 954
953 46
998 1
...

result:

ok OK in maximum 1165 operations

Test #35:

score: 0
Accepted
time: 2ms
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 473 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 ...

output:

1257
1 1
3 996
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 1
3 996
1 998
1 998
1 998
1 998
1 998
1 998
1 998...

result:

ok OK in maximum 1257 operations

Test #36:

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

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:

1753
2 997
1 1
2 996
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
640 359
361 638
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998...

result:

ok OK in maximum 1753 operations

Test #37:

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

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:

1750
2 997
1 1
2 996
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998
2 1
1 998...

result:

ok OK in maximum 1750 operations

Test #38:

score: 0
Accepted
time: 1ms
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:

1900
1 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1 997
2 1
1...

result:

ok OK in maximum 1900 operations

Test #39:

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

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:

1319
997 1
997 1
2 995
994 4
997 1
2 992
991 7
997 1
2 989
988 10
997 1
2 986
985 13
997 1
2 983
982 16
997 1
2 980
979 19
997 1
2 977
976 22
997 1
2 974
973 25
997 1
2 971
970 28
997 1
2 968
967 31
997 1
2 965
964 34
997 1
2 962
961 37
997 1
2 959
958 40
997 1
2 956
955 43
997 1
2 953
952 46
997 1
...

result:

ok OK in maximum 1319 operations

Test #40:

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

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:

1274
1 1
3 995
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 1274 operations

Test #41:

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

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:

1969
1 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
1 1
363 634
636 361
3 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1 996
2 1
1...

result:

ok OK in maximum 1969 operations

Test #42:

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

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:

1477
996 1
996 1
2 994
993 4
996 1
2 991
990 7
996 1
2 988
987 10
996 1
2 985
984 13
996 1
2 982
981 16
996 1
2 979
978 19
996 1
2 976
975 22
996 1
2 973
972 25
996 1
2 970
969 28
996 1
2 967
966 31
996 1
2 964
963 34
996 1
2 961
960 37
996 1
2 1
350 647
1 1
648 349
994 3
4 956
955 42
42 1
1 996
953...

result:

ok OK in maximum 1477 operations

Test #43:

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

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:

1277
1 1
3 994
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 1277 operations

Test #44:

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

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:

1925
1 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1...

result:

ok OK in maximum 1925 operations

Test #45:

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

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:

1204
995 1
995 1
2 993
992 4
995 1
2 990
989 7
995 1
2 987
986 10
995 1
2 984
983 13
995 1
2 981
980 16
995 1
2 978
977 19
995 1
2 975
974 22
995 1
2 972
971 25
995 1
2 969
968 28
995 1
2 966
965 31
995 1
2 963
962 34
995 1
2 960
959 37
995 1
2 957
956 40
995 1
2 954
953 43
995 1
2 951
950 46
995 1
...

result:

ok OK in maximum 1204 operations

Test #46:

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

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:

1330
1 1
3 993
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 1330 operations

Test #47:

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

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:

1375
1 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
1 1
171 614
616 168
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
262 523
525 260
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1 784
2 1
1...

result:

ok OK in maximum 1375 operations

Test #48:

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

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:

1398
977 1
977 1
2 975
974 4
977 1
2 972
971 7
977 1
2 969
968 10
977 1
2 966
965 13
977 1
2 963
962 16
977 1
2 960
959 19
977 1
2 957
956 22
977 1
2 954
953 25
977 1
2 951
950 28
977 1
2 948
947 31
977 1
2 945
944 34
977 1
2 942
941 37
977 1
2 939
938 40
977 1
2 936
935 43
44 1
332 646
1 1
647 331
...

result:

ok OK in maximum 1398 operations

Test #49:

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

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:

1051
1 1
3 794
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 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 796
1 796
1 796
1 1
3 794
1 796
1 796
1 796
1 796
1 796
1 796
1 796
1 796...

result:

ok OK in maximum 1051 operations

Test #50:

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

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:

1911
1 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1 995
2 1
1...

result:

ok OK in maximum 1911 operations

Test #51:

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

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:

1229
874 1
874 1
2 872
871 4
874 1
2 869
868 7
874 1
2 866
865 10
874 1
2 863
862 13
874 1
2 860
859 16
874 1
2 857
856 19
874 1
2 854
853 22
874 1
2 851
850 25
874 1
2 848
847 28
874 1
2 845
844 31
874 1
2 842
841 34
874 1
2 1
500 375
1 1
376 499
872 3
4 837
836 39
39 1
1 874
834 41
41 1
1 874
832 ...

result:

ok OK in maximum 1229 operations

Test #52:

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

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:

1246
1 1
3 987
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 1
3 987
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...

result:

ok OK in maximum 1246 operations

Test #53:

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

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:

1928
1 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1 992
2 1
1...

result:

ok OK in maximum 1928 operations

Test #54:

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

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:

1178
987 1
987 1
2 985
984 4
987 1
2 982
981 7
987 1
2 979
978 10
987 1
2 976
975 13
987 1
2 973
972 16
987 1
2 970
969 19
987 1
2 967
966 22
987 1
2 964
963 25
987 1
2 961
960 28
987 1
2 958
957 31
987 1
2 955
954 34
987 1
2 952
951 37
987 1
2 949
948 40
987 1
2 946
945 43
987 1
2 943
942 46
987 1
...

result:

ok OK in maximum 1178 operations

Test #55:

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

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:

1381
1 1
3 991
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 9...

result:

ok OK in maximum 1381 operations

Test #56:

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

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:

1483
1 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1 777
2 1
1...

result:

ok OK in maximum 1483 operations

Test #57:

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

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:

1138
795 1
795 1
2 793
792 4
795 1
2 790
789 7
795 1
2 787
786 10
795 1
2 784
783 13
795 1
2 781
780 16
795 1
2 778
777 19
795 1
2 775
774 22
795 1
2 772
771 25
795 1
2 769
768 28
795 1
2 766
765 31
795 1
2 763
762 34
795 1
2 1
528 268
1 1
269 527
793 3
4 758
757 39
39 1
1 795
755 41
41 1
1 795
753 ...

result:

ok OK in maximum 1138 operations

Test #58:

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

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:

896
1 1
3 662
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 1
3 662
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 664
1 664
1 664
1 664
1 664
...

result:

ok OK in maximum 896 operations

Test #59:

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

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:

1499
1 1
968 31
606 393
135 864
1 1
779 220
265 734
180 819
1 1
92 907
1 1
618 381
1 1
654 345
107 892
1 1
80 919
314 685
1 1
424 575
1 1
184 815
581 418
1 1
132 867
341 658
223 776
1 1
333 665
589 410
212 787
1 1
630 369
1 1
683 316
1 1
928 71
1 1
29 970
374 625
1 1
290 709
1 1
282 717
1 1
719 280
...

result:

ok OK in maximum 1499 operations

Test #60:

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

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:

1483
44 954
724 274
1 1
285 713
1 1
122 876
700 298
1 1
69 929
770 228
355 643
216 782
832 166
1 1
820 178
519 479
713 285
316 682
634 364
1 1
274 724
310 687
120 878
1 1
637 361
1 1
313 685
1 1
233 765
388 610
572 426
520 478
441 557
1 1
103 895
805 193
664 334
434 564
1 1
540 458
1 1
9 989
1 1
398...

result:

ok OK in maximum 1483 operations

Test #61:

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

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:

1494
925 74
30 969
501 498
76 923
1 1
816 183
1 1
342 657
812 187
692 307
920 79
1 1
186 813
323 676
224 775
1 1
287 712
1 1
914 85
395 604
1 1
485 514
1 1
594 405
867 132
1 1
721 278
1 2
284 715
754 245
70 929
384 615
1 1
960 39
757 242
747 252
1 1
921 78
413 586
948 51
204 795
881 118
1 1
930 69
7...

result:

ok OK in maximum 1494 operations

Test #62:

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

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:

1479
1 1
140 858
779 219
953 45
506 492
753 245
435 563
1 1
615 383
464 534
240 758
1 1
849 149
549 449
1 1
15 983
1 1
975 23
1 1
956 42
808 190
568 430
270 728
859 139
1 1
245 753
2 1
504 494
1 1
953 45
346 652
1 1
969 29
1 1
885 113
441 557
1 1
366 632
1 1
628 370
1 1
94 904
513 485
1 1
193 805
44...

result:

ok OK in maximum 1479 operations

Test #63:

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

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:

1528
1 1
432 567
1 1
663 336
1 1
30 969
1 1
65 934
1 1
509 490
1 1
270 729
1 1
152 846
838 161
1 1
264 735
1 1
237 762
488 511
1 1
413 586
1 1
865 134
1 1
542 457
1 1
959 40
491 508
2 1
993 6
1 1
363 636
657 342
1 1
894 105
1 1
336 663
1 1
830 169
1 1
209 790
1 1
404 595
1 1
798 201
1 1
531 468
304 ...

result:

ok OK in maximum 1528 operations

Test #64:

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

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:

1498
598 400
894 104
267 731
926 72
495 503
562 436
1 1
732 266
1 1
156 842
1 1
897 101
806 192
1 1
274 724
1 1
167 831
731 267
1 1
695 303
152 846
1 1
532 466
1 1
804 194
347 651
1 1
52 946
2 996
759 239
9 989
1 1
455 543
1 1
560 438
106 892
342 656
1 1
309 689
1 1
283 715
185 813
408 589
1 1
232 7...

result:

ok OK in maximum 1498 operations

Test #65:

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

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:

1483
698 301
392 607
1 1
514 485
1 1
29 970
1 1
559 440
177 822
320 679
304 695
510 489
745 254
682 317
1 1
387 612
1 1
536 463
305 694
728 271
1 1
918 81
584 415
1 1
377 622
1 1
722 277
1 1
117 882
596 403
1 1
903 96
675 324
1 1
564 435
1 1
888 111
1 1
159 840
1 1
622 377
1 1
973 25
300 699
808 191...

result:

ok OK in maximum 1483 operations

Test #66:

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

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:

1500
1 1
985 13
156 842
1 1
579 419
1 1
531 467
182 816
778 220
532 466
398 600
1 1
905 93
941 57
778 220
237 761
1 1
254 744
1 1
598 400
643 355
133 865
143 855
1 1
46 952
1 1
565 433
1 1
67 931
30 968
1 1
519 479
541 457
1 1
65 933
1 1
415 583
27 971
213 785
1 1
864 134
1 1
958 40
702 296
1 1
892 ...

result:

ok OK in maximum 1500 operations

Test #67:

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

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:

1463
1 1
116 883
1 1
852 147
1 1
565 434
273 726
1 1
618 381
1 1
764 235
1 1
531 468
1 1
252 747
1 1
587 412
290 709
1 1
7 992
1 1
591 408
1 1
765 234
835 164
836 163
1 1
401 598
1 1
712 287
1 1
13 986
1 1
790 208
584 415
463 536
1 1
272 727
1 1
402 597
648 351
227 772
1 1
16 983
1 1
696 303
376 623...

result:

ok OK in maximum 1463 operations

Test #68:

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

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:

1467
578 420
190 808
1 1
242 756
1 1
446 552
1 1
876 122
1 1
975 23
105 893
196 802
122 876
1 1
199 799
1 1
772 226
25 972
201 797
788 210
1 1
354 644
570 428
438 560
232 766
1 1
153 845
438 560
1 1
939 59
992 6
1 1
991 7
410 588
336 662
911 87
1 1
69 929
1 1
679 318
236 762
1 1
515 483
1 1
961 37
5...

result:

ok OK in maximum 1467 operations

Test #69:

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

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:

1476
1 1
165 834
197 802
609 390
1 1
998 1
2 1
241 758
1 1
469 530
728 271
991 8
1 1
317 682
519 480
315 684
874 125
483 516
774 225
262 737
725 274
58 941
355 644
936 63
333 666
1 1
555 444
62 937
1 1
435 564
1 1
247 752
1 1
371 628
782 217
135 864
1 2
938 61
273 726
1 1
797 202
89 910
1 1
761 238
...

result:

ok OK in maximum 1476 operations

Test #70:

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

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:

1492
28 970
158 840
94 904
704 294
494 504
1 1
759 239
1 1
204 794
751 247
973 25
986 12
991 7
152 846
1 1
696 302
511 487
723 275
1 1
312 686
821 177
1 1
89 909
360 638
319 679
1 1
172 826
1 1
238 760
1 1
567 431
1 1
166 832
1 1
682 316
664 334
1 1
19 979
1 1
19 979
930 68
1 1
268 730
1 1
30 968
34...

result:

ok OK in maximum 1492 operations

Test #71:

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

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:

1498
1 1
768 231
417 582
1 1
236 763
1 1
330 669
830 169
559 440
325 674
1 1
990 9
491 508
1 1
903 96
1 1
391 608
103 896
972 27
1 1
40 959
329 670
970 29
796 202
790 209
756 243
1 1
259 740
500 499
1 1
414 585
463 536
454 545
1 1
559 440
830 169
1 1
812 187
929 70
617 382
1 1
678 321
586 413
1 1
58...

result:

ok OK in maximum 1498 operations

Test #72:

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

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:

1487
215 783
9 989
599 399
97 901
1 1
211 787
408 590
611 387
704 294
850 148
221 777
1 1
266 732
925 73
649 349
789 209
1 1
335 663
960 38
778 220
1 1
715 283
653 345
1 1
848 150
2 2
760 238
89 909
457 541
1 1
996 2
334 664
837 161
457 541
333 665
414 584
53 945
1 1
567 430
1 1
240 758
1 1
711 287
...

result:

ok OK in maximum 1487 operations