QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#409805#6838. Assumption is All You NeedKevin5307AC ✓503ms21448kbC++231.9kb2024-05-12 18:46:492024-05-12 18:47:05

Judging History

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

  • [2024-05-12 18:47:05]
  • 评测
  • 测评结果:AC
  • 用时:503ms
  • 内存:21448kb
  • [2024-05-12 18:46:49]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int a[3030],b[3030],n;
int mn[3030<<2];
void modify(int x,int l,int r,int p,int v)
{
	if(l==r)
	{
		mn[x]=v;
		return ;
	}
	int mid=(l+r)/2;
	if(p<=mid)
		modify(x<<1,l,mid,p,v);
	else
		modify((x<<1)|1,mid+1,r,p,v);
	mn[x]=min(mn[x<<1],mn[(x<<1)|1]);
}
int query(int x,int l,int r,int ql,int qr)
{
	if(l==ql&&r==qr) return mn[x];
	int mid=(l+r)/2;
	if(qr<=mid)
		return query(x<<1,l,mid,ql,qr);
	if(ql>mid)
		return query((x<<1)|1,mid+1,r,ql,qr);
	return min(query(x<<1,l,mid,ql,mid),query((x<<1)|1,mid+1,r,mid+1,qr));
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		cin>>n;
		for(int i=1;i<=n;i++)
		{
			cin>>a[i];
			modify(1,1,n,a[i],i);
		}
		for(int i=1;i<=n;i++)
			cin>>b[i];
		bool ok=true;
		vector<pii> res;
		int p=1;
		while(p<=n)
		{
			if(a[p]==b[p])
			{
				modify(1,1,n,a[p],inf);
				p++;
				continue;
			}
			if(a[p]<b[p])
			{
				ok=false;
				break;
			}
			int x=query(1,1,n,b[p],a[p]-1);
			swap(a[p],a[x]);
			modify(1,1,n,a[p],p);
			modify(1,1,n,a[x],x);
			res.pb(p,x);
		}
		if(!ok)
			cout<<"-1\n";
		else
		{
			cout<<sz(res)<<'\n';
			for(auto pr:res)
				cout<<pr.first<<" "<<pr.second<<'\n';
		}
	}
	return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

input:

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

output:

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

result:

ok T=3

Test #2:

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

input:

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

output:

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

result:

ok T=315

Test #3:

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

input:

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

output:

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

result:

ok T=297

Test #4:

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

input:

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

output:

0
-1
-1
-1
-1
-1
1
2 3
-1
-1
-1
-1
6
1 2
1 4
2 3
3 4
3 5
4 5
-1
-1
-1
-1
16
1 2
3 4
3 5
3 8
4 5
4 7
4 8
5 7
5 8
5 9
7 8
7 10
8 9
8 12
9 10
9 12
-1
4
1 2
1 3
2 3
3 4
-1
-1
-1
-1
-1
-1
-1
-1
-1
0
-1
0
-1
-1
-1
-1
-1
-1
8
1 5
1 7
2 6
3 5
3 6
4 5
5 6
5 7
-1
-1
-1
5
1 3
1 4
2 3
2 4
3 4
-1
-1
0
-1
-1
-1
-...

result:

ok T=268

Test #5:

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

input:

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

output:

-1
-1
-1
-1
-1
1
2 5
0
5
1 2
1 3
2 3
3 4
3 5
-1
-1
-1
-1
-1
-1
-1
-1
-1
1
1 3
-1
-1
-1
-1
-1
13
1 4
1 8
2 4
2 5
3 4
3 5
3 6
4 5
4 6
4 8
5 6
5 8
6 8
7
1 2
2 3
3 4
3 5
3 7
5 6
5 7
-1
-1
-1
-1
-1
-1
-1
2
4 5
5 6
-1
-1
-1
-1
3
1 7
2 5
3 6
3
2 5
3 4
4 5
-1
-1
-1
-1
6
1 3
2 3
2 4
2 5
3 4
4 5
-1
-1
-1
20
1...

result:

ok T=260

Test #6:

score: 0
Accepted
time: 1ms
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1
-1
-1
-1
-1
20
1 3
1 5
2 3
2 4
2 5
2 7
2 9
3 4
3 5
3 6
3 7
3 8
6 7
6 8
6 9
6 10
7 8
7 9
7 10
9 10
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
7
1 2
1 4
1 5
1 6
4 5
4 6
5 6
7
1 2
1 5
1 6...

result:

ok T=223

Test #8:

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

input:

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

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
9
1 4
2 5
3 4
3 7
3 8
4 5
4 7
6 7
6 8
-1
13
1 2
1 3
1 6
2 3
3 4
3 5
3 6
4 5
4 6
5 6
6 7
6 8
6 9
-1
-1
-1
-1
-1
17
1 6
2 3
2 4
2 5
3 4
3 5
3 6
3 9
4 5
4 6
4 9
5 6
5 7
5 8
6 7
6 8
7 8
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok T=213

Test #9:

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

input:

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

output:

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

result:

ok T=203

Test #10:

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

input:

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

output:

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

result:

ok T=192

Test #11:

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

input:

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

output:

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

result:

ok T=184

Test #12:

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

input:

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

output:

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

result:

ok T=176

Test #13:

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

input:

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

output:

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

result:

ok T=169

Test #14:

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

input:

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

result:

ok T=290

Test #16:

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

input:

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

output:

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

result:

ok T=278

Test #17:

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

input:

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

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
16
1 2
1 7
2 3
2 5
2 8
3 5
3 6
3 8
3 10
4 7
5 6
5 8
5 10
6 7
8 9
8 10
-1
-1
-1
-1
-1
3
1 2
2 4
4 5
-1
-1
-1
-1
9
1 2
1 4
3 4
3 5
3 6
4 5
4 6
4 7
7 8
-1
-1
-1
2
1 2
1 3
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1
1 3
-1
-1
-1
14
1 3
1 4
1 6
1 9
3 4
3 5
3 6
4 5
4 6
4 8
4 ...

result:

ok T=253

Test #18:

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

input:

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

output:

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

result:

ok T=240

Test #19:

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

input:

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

result:

ok T=211

Test #21:

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

input:

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

output:

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

result:

ok T=202

Test #22:

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

input:

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

output:

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

result:

ok T=191

Test #23:

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

input:

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

output:

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

result:

ok T=184

Test #24:

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

input:

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

output:

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

result:

ok T=176

Test #25:

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

input:

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

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
24
1 2
1 7
1 8
1 12
2 5
2 7
2 8
3 4
3 5
3 6
4 5
4 6
4 7
4 8
5 6
5 7
6 7
6 8
7 8
7 9
8 9
8 11
9 10
9 12
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
18
1 6
1 10
2 3
2 5
3 4
3 5
3 6
3 7
5 6
5 7
...

result:

ok T=169

Test #26:

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

input:

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

output:

-1
-1
-1
0
-1
0
-1
-1
-1
0
-1
-1
-1
-1
-1
-1
-1
0
-1
0
-1
-1
-1
-1
4
1 2
1 4
2 5
3 5
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
1 3
2 3
2 4
3 4
0
0
-1
-1
-1
-1
3
1 2
1 4
3 4
4
1 2
2 4
3 4
3 5
-1
-1
-1
-1
8
2 5
2 6
3 5
3 6
4 5
4 6
6 7
7 8
-1
-1
-1
-1
1
1 3
0
-1
-1
-1
-1
1
1 2
0
-1
-1
0
-1
-1
-1
-1
24
1 2
1 3
1 ...

result:

ok T=318

Test #27:

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

input:

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

result:

ok T=242

Test #31:

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

input:

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

output:

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

result:

ok T=225

Test #32:

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

input:

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

output:

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

result:

ok T=216

Test #33:

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

input:

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

output:

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

result:

ok T=204

Test #34:

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

input:

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

output:

-1
-1
-1
14
1 3
1 4
1 5
1 6
2 3
2 7
2 9
3 4
3 5
4 5
5 6
6 7
6 8
8 9
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
28
1 7
2 3
2 4
2 5
2 7
2 9
2 11
3 4
3 5
3 7
4 5
4 6
4 7
4 8
4 9
4 10
4 11
5 6
5 7
5 8
5 9
6 7
6 8
6 9
6 10
6 11
9 10
9 11
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
18
1 5
2...

result:

ok T=192

Test #35:

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

input:

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

output:

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

result:

ok T=184

Test #36:

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

input:

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

output:

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

result:

ok T=177

Test #37:

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

input:

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

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
25
1 3
1 4
1 9
2 3
2 4
2 5
3 4
3 5
4 5
4 7
4 12
5 6
5 7
5 8
5 9
6 7
6 8
6 9
6 10
6 11
7 8
8 9
8 10
9 10
9 12
-1
-1
-1
-1
-1
-1
-1
15
1 2
1 3
2 3
2 5
3 5
4 5
4 6
4 7
5 6
5 7
5 9
5 10
6 7
8 9
11 12...

result:

ok T=169

Test #38:

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

input:

1
2021
159 449 1929 131 966 1205 529 1402 1942 262 857 1933 153 843 211 1163 277 307 850 663 786 1128 540 1637 1240 1660 266 461 437 1830 1066 1975 1486 1508 1916 950 1285 256 877 1669 1395 1765 67 1780 1667 1673 1060 1170 205 1615 1102 747 487 1993 1311 1634 1767 45 1964 1242 1602 1821 472 1997 158...

output:

-1

result:

ok T=1

Test #39:

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

input:

1
2021
58 527 1152 344 887 1537 133 883 1085 1830 637 1764 1812 454 373 923 1580 254 266 881 811 1257 563 1937 204 451 2006 1002 232 872 1405 999 788 440 1040 1977 1992 1441 914 314 1741 1791 1447 438 1452 1333 221 247 1920 1407 1399 1243 393 1234 1749 25 707 557 1030 269 712 480 899 796 1512 1858 1...

output:

-1

result:

ok T=1

Test #40:

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

input:

1
2021
1607 1750 1767 558 581 1869 1753 1341 229 1634 607 1017 699 33 175 1012 222 1698 1684 1091 763 874 440 319 1165 1682 1581 578 1380 601 1729 1967 1290 147 1169 1018 1419 1155 74 1024 1151 1816 1588 1661 1614 1209 1328 676 1662 136 957 1058 701 64 219 382 1598 1724 192 210 999 1706 1326 631 367...

output:

-1

result:

ok T=1

Test #41:

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

input:

1
2021
1506 1716 990 1589 501 441 183 1311 1385 1191 388 144 1300 1620 640 772 1525 869 428 1310 1902 1194 463 136 702 793 131 1120 535 171 77 2019 848 419 73 55 943 740 1217 1651 681 658 989 319 1399 2004 489 1728 1404 1900 741 1092 1787 1022 1374 739 650 928 1325 151 109 1196 1382 466 299 454 1379...

output:

-1

result:

ok T=1

Test #42:

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

input:

1
2021
287 919 676 1802 1980 516 1803 792 821 1943 169 1406 1245 1199 1463 862 167 308 338 908 1041 811 340 1872 1663 28 788 1680 331 1044 1299 854 151 775 965 1086 1490 197 1255 297 1027 683 1377 1739 1257 529 1596 893 1960 1096 299 1370 314 827 1811 1808 1555 1440 486 1324 396 158 694 22 231 1758 ...

output:

-1

result:

ok T=1

Test #43:

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

input:

1
2021
1400 552 640 1009 894 1940 517 471 293 1794 1578 1534 1967 1840 500 520 1609 535 649 1903 561 13 927 537 364 1526 884 482 1667 733 668 1292 1407 1606 498 779 1498 1524 259 442 410 859 282 391 1820 804 686 670 1812 1786 1653 1185 176 1297 1504 1464 505 1475 1171 1341 1484 1813 284 1048 952 85 ...

output:

-1

result:

ok T=1

Test #44:

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

input:

1
2021
181 1775 327 789 815 256 121 441 1751 403 1359 661 1912 1419 303 610 251 482 1396 739 1399 334 804 916 312 1081 1429 1024 1462 2007 992 315 709 538 164 1806 1022 1237 296 1151 1921 884 422 1027 1641 464 414 1099 734 982 594 1000 82 287 1941 567 1410 891 194 1282 593 775 1555 882 1980 1290 191...

output:

-1

result:

ok T=1

Test #45:

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

input:

1
2021
1731 977 1568 1002 277 588 1741 410 593 1155 1140 1924 504 998 1126 370 1554 1150 1306 957 538 1950 1490 734 1847 316 92 1565 1095 1176 1331 1283 268 246 294 851 1569 822 1439 735 1451 1706 1803 1862 1463 340 1521 177 476 306 1507 1496 1168 1084 1219 924 350 307 1319 493 1664 1394 23 127 1759...

output:

-1

result:

ok T=1

Test #46:

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

input:

1
2021
1629 1055 1255 1841 429 1688 1012 380 1750 1907 1110 1050 1929 577 1591 460 852 589 1217 1167 792 271 1513 552 237 659 636 113 250 906 1670 306 514 1166 1185 1874 1156 280 1476 1362 1797 1731 1943 520 1247 1976 682 606 1032 1474 1908 1312 1664 1882 1656 1281 1353 818 488 1993 1951 660 449 192...

output:

-1

result:

ok T=1

Test #47:

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

input:

1
2021
410 1290 1406 228 1908 1764 617 350 1186 648 123 1609 1050 28 1393 1485 1499 268 1963 1386 1931 1696 1390 290 1197 659 1668 1683 1561 1779 885 1228 1805 874 89 915 679 1849 131 1028 1207 1757 1344 1743 1106 1636 1789 1657 1934 1267 850 1345 781 871 935 1638 293 22 1613 1422 277 150 1350 1754 ...

output:

-1

result:

ok T=1

Test #48:

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

input:

1
2021
1504 1677 1679 1151 729 863 1230 523 1815 1275 105 1640 1968 1837 1190 1569 1741 1773 1375 1 1365 1678 653 1278 951 505 2001 1604 238 898 550 1343 932 84 1782 536 418 295 727 891 88 875 1858 1600 1846 900 1001 1988 1248 554 110 1171 535 225 1538 799 1298 280 82 18 444 996 402 938 1726 984 420...

output:

-1

result:

ok T=1

Test #49:

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

input:

1
2021
1238 1946 1904 683 418 408 270 1259 414 1921 633 614 505 374 10 632 653 443 452 1759 409 160 1710 305 482 686 1076 1417 170 72 1065 1782 1950 696 1515 1223 607 1954 901 196 1301 1050 889 1962 280 528 1237 141 1841 349 1720 1778 1049 1941 466 1943 1644 121 513 1674 1976 373 437 500 1752 2011 2...

output:

-1

result:

ok T=1

Test #50:

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

input:

1
2021
23 274 281 1861 1361 1377 1940 301 1302 1339 932 347 894 1144 959 624 1064 471 1819 1958 1620 1297 899 1904 1745 849 636 784 875 1374 1058 1643 1571 378 1167 1834 427 1299 510 693 1115 684 1085 364 1736 1410 463 406 896 1050 1541 1447 1734 112 78 1606 542 1171 334 1456 1384 1254 26 1791 75 16...

output:

-1

result:

ok T=1

Test #51:

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

input:

1
2021
1398 1173 413 1200 819 410 139 1525 1907 1170 1460 603 616 1690 441 953 692 1921 896 1095 663 883 1956 369 1686 1029 348 1643 1284 548 1573 1024 856 990 900 534 1576 718 685 1018 1283 858 364 338 170 1134 700 1728 677 716 564 303 467 1828 1781 784 874 1224 904 1150 839 631 62 1353 2012 300 15...

output:

-1

result:

ok T=1

Test #52:

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

input:

1
2021
579 600 152 1853 508 211 28 735 498 620 1799 882 867 1947 965 16 1610 83 1482 860 1708 660 1014 1395 1627 1974 59 428 1053 1715 966 1462 141 955 1998 1212 1765 521 354 405 1330 1837 387 1287 885 1642 907 1076 1270 511 1557 497 391 744 1517 851 1220 1065 2003 1892 1707 1664 1986 603 245 49 742...

output:

-1

result:

ok T=1

Test #53:

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

input:

2
667
658 518 298 102 661 94 304 134 327 618 635 452 44 438 473 385 271 198 139 76 616 583 290 430 1 536 272 254 660 316 153 13 557 203 245 89 584 9 590 600 554 88 598 187 195 208 471 249 183 570 368 612 422 112 378 573 529 96 475 18 348 355 127 338 312 124 141 293 382 513 362 451 145 227 585 28 310...

output:

-1
-1

result:

ok T=2

Test #54:

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

input:

2
488
184 6 413 34 320 437 78 330 54 20 337 196 452 246 444 403 332 28 111 189 188 190 305 283 381 301 221 181 109 142 224 159 282 117 206 241 77 161 37 335 89 377 423 425 487 418 234 81 274 46 290 378 33 368 115 385 258 230 240 192 175 13 133 427 356 328 172 4 336 8 323 488 273 450 194 74 67 155 13...

output:

-1
-1

result:

ok T=2

Test #55:

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

input:

2
1623
121 597 50 983 1018 373 1558 1243 940 1519 1414 1178 417 851 1168 1425 1042 1201 1374 993 886 1279 1324 456 73 43 67 1607 1381 194 1588 271 1122 782 341 46 1033 699 654 726 250 1577 1420 1108 85 1116 968 1210 988 326 455 92 273 1486 1581 1211 773 107 201 692 1377 551 1231 448 685 832 383 1544...

output:

-1
-1

result:

ok T=2

Test #56:

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

input:

2
400
261 93 36 290 148 344 57 388 103 208 67 273 142 131 78 87 115 216 160 152 346 373 130 332 384 175 391 105 264 84 253 293 66 61 195 53 307 101 314 108 12 145 382 164 162 184 179 247 123 204 303 55 28 59 285 381 362 32 134 181 299 256 14 255 180 351 4 361 116 127 366 345 245 168 272 343 324 166 ...

output:

-1
-1

result:

ok T=2

Test #57:

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

input:

2
1890
493 1424 1739 1504 1044 1876 847 1870 389 1873 557 454 744 568 64 1049 260 1609 1850 229 1653 957 1846 623 1874 1185 1352 38 470 371 837 94 1798 1576 302 42 797 1362 1075 1732 1487 60 714 230 160 1861 504 1612 861 854 1293 792 916 1229 702 1415 369 1373 1485 293 1146 392 1875 503 474 30 288 1...

output:

-1
-1

result:

ok T=2

Test #58:

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

input:

2
1907
1818 1724 723 1327 1816 8 869 1845 151 351 785 399 304 763 1681 974 1637 56 1328 1082 1092 563 1610 1008 1814 1461 1200 1063 1469 461 66 880 1257 116 358 363 364 783 1412 275 1720 1102 1252 1223 302 722 1543 509 831 884 528 1529 501 1886 1658 1633 139 1066 1446 984 73 1549 483 1249 209 437 16...

output:

-1
-1

result:

ok T=2

Test #59:

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

input:

2
1740
971 1324 1071 929 662 116 1170 575 472 1077 1430 747 737 184 961 1315 728 12 792 1478 1622 638 1085 1609 208 95 546 1187 1255 1026 1143 1521 161 1448 1571 1499 176 587 390 1563 288 854 447 685 1003 1221 1591 1617 434 334 389 201 947 1697 1423 407 832 1730 1092 454 741 1444 1679 226 880 539 16...

output:

-1
-1

result:

ok T=2

Test #60:

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

input:

2
1204
570 1121 1008 341 1122 41 914 734 792 468 571 1154 500 74 519 441 1099 673 880 737 159 968 313 1074 559 791 380 57 585 742 599 210 669 685 700 133 73 855 865 714 17 209 852 767 911 658 418 450 802 741 912 774 1129 485 200 36 436 226 731 813 871 228 297 581 716 930 298 836 1095 230 566 318 850...

output:

-1
-1

result:

ok T=2

Test #61:

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

input:

2
1879
882 1033 954 361 1146 1562 186 374 112 1822 571 1578 1050 924 1055 727 1764 346 1862 1223 399 1140 192 1645 1673 431 987 376 713 1397 731 1250 229 800 875 1294 1768 232 280 1424 521 400 1451 1236 92 1120 1656 476 1505 878 25 308 1091 1014 1679 1672 664 1566 473 1438 242 493 1697 1174 847 121 ...

output:

-1
-1

result:

ok T=2

Test #62:

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

input:

2
1348
631 74 1244 734 602 345 890 837 57 1102 730 646 1226 783 832 731 46 955 921 712 400 136 1171 1124 1173 627 213 874 1236 290 482 915 1113 578 1319 902 124 1074 736 520 576 109 954 1067 215 1331 1340 131 1055 1120 1290 1064 292 145 758 1022 1187 159 56 1211 59 503 1114 65 72 1053 1198 1156 595 ...

output:

-1
-1

result:

ok T=2

Test #63:

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

input:

2
2020
732 976 1728 167 1386 1830 1323 345 1212 1696 1978 1267 1392 652 1032 457 1159 367 1282 1384 974 1682 615 484 1117 1754 1608 1886 361 1081 944 1750 1759 1638 1606 1360 8 714 1848 1869 157 1321 897 608 995 433 364 1503 1394 1803 1545 1201 512 401 1426 1397 1874 787 1091 205 599 1128 1455 1443 ...

output:

-1
0

result:

ok T=2

Test #64:

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

input:

2
2020
236 1201 1886 547 930 29 533 950 1042 213 952 1518 1810 1839 95 1374 1834 2010 418 656 752 887 1079 425 1173 1465 473 302 1687 1596 278 1291 1723 1371 306 277 1667 889 1153 1101 332 1344 1458 1323 1502 669 422 123 1785 1954 1277 1126 421 1296 604 1743 1714 1357 55 288 1632 48 1017 581 575 112...

output:

-1
0

result:

ok T=2

Test #65:

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

input:

2
2020
603 1597 227 567 1388 1699 1101 126 460 513 1389 1378 572 1084 283 1151 1861 811 617 752 1888 75 679 705 228 1025 1834 529 837 1589 186 655 65 1023 925 345 628 1975 1650 1731 1946 548 248 462 409 1841 687 1985 1890 1263 946 1811 399 817 711 641 800 1178 1799 1693 857 2019 350 924 1780 1200 10...

output:

-1
0

result:

ok T=2

Test #66:

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

input:

2
2020
1117 1774 385 948 933 739 799 430 1107 1040 363 1629 2020 1608 1352 1413 1039 1891 1756 1797 770 986 1705 1220 409 736 1647 938 11 98 578 884 29 756 1604 534 431 167 1975 1898 140 571 222 1140 37 132 745 1993 181 798 1771 1134 307 554 158 987 641 1757 1493 600 234 788 224 950 341 1521 14 1451...

output:

-1
0

result:

ok T=2

Test #67:

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

input:

2
2020
834 380 668 637 733 1802 9 1034 1753 1568 643 1352 1374 428 1485 325 1982 473 1521 1955 548 44 170 1735 1697 73 1460 1185 33 1511 1949 425 642 1250 304 660 1962 341 1280 1130 1111 1581 782 1854 544 339 1357 1531 1351 1792 409 468 1192 1449 1746 1318 694 372 1003 55 139 823 1432 88 1947 695 94...

output:

-1
0

result:

ok T=2

Test #68:

score: 0
Accepted
time: 409ms
memory: 20196kb

input:

1
2021
1978 1866 1979 2003 1980 1827 1895 1970 1823 1907 2021 1870 1963 1990 1942 1917 1952 1853 1966 1962 1975 1862 1865 1877 1945 1897 1864 1954 1809 1944 1819 1804 1888 1812 2004 1940 1890 1842 1994 1863 1878 1914 1900 1923 1915 1824 2006 1779 2000 1925 1884 1789 1813 2002 1935 1959 2017 1788 177...

output:

1664109
1 2
1 6
1 9
1 29
1 32
1 48
1 59
1 67
1 69
1 91
1 94
1 99
1 126
1 154
1 163
1 166
1 178
1 179
1 193
1 207
1 209
1 233
1 236
1 240
1 256
1 265
1 275
1 292
1 312
1 326
1 329
1 333
1 348
1 372
1 401
1 405
1 427
1 444
1 450
1 459
1 470
1 472
1 477
1 482
1 495
1 501
1 514
1 533
1 550
1 557
1 566
1...

result:

ok T=1

Test #69:

score: 0
Accepted
time: 402ms
memory: 20512kb

input:

1
2021
2005 1973 1895 2014 1932 1912 1859 2018 1851 1983 1934 1963 1898 1849 1962 1941 1819 2016 1850 1808 1887 1984 1902 1832 1949 1990 1944 1842 1942 1856 1855 1845 1833 1989 2017 1945 1886 1813 1803 1804 1789 1915 1874 1982 1888 1935 1821 1784 1857 1796 2020 1834 1770 1954 1831 1816 2006 1797 186...

output:

1656284
1 2
1 3
1 7
1 9
1 14
1 17
1 20
1 39
1 41
1 48
1 53
1 72
1 77
1 88
1 95
1 100
1 115
1 121
1 124
1 128
1 141
1 155
1 166
1 176
1 180
1 188
1 206
1 209
1 240
1 242
1 254
1 281
1 296
1 299
1 300
1 308
1 322
1 334
1 336
1 368
1 369
1 379
1 385
1 409
1 411
1 424
1 437
1 438
1 445
1 457
1 466
1 467...

result:

ok T=1

Test #70:

score: 0
Accepted
time: 403ms
memory: 20372kb

input:

1
2021
1895 1879 1922 1889 1951 1840 1824 1925 1991 1948 1867 1878 1833 1933 1983 1896 1843 1812 1936 1856 2011 1994 1960 1808 1953 1950 1935 1841 1874 1949 1847 1886 1846 2019 1853 1791 2017 1987 1900 1947 1837 1999 1848 1865 1861 1801 1814 1923 1993 1802 1787 2009 1816 1946 1817 1984 1835 1805 189...

output:

1647470
1 2
1 6
1 7
1 18
1 24
1 36
1 51
1 77
1 80
1 86
1 108
1 109
1 120
1 128
1 139
1 153
1 156
1 187
1 213
1 223
1 227
1 234
1 248
1 256
1 264
1 272
1 286
1 297
1 309
1 310
1 312
1 329
1 337
1 345
1 354
1 369
1 381
1 404
1 413
1 414
1 431
1 455
1 480
1 491
1 519
1 521
1 551
1 553
1 557
1 570
1 581...

result:

ok T=1

Test #71:

score: 0
Accepted
time: 386ms
memory: 19688kb

input:

1
2021
1921 2021 1838 1966 1834 1969 2013 1970 1816 1823 2003 1837 2014 1993 2011 1920 1980 1983 1820 1973 1846 2001 1996 1897 1958 1819 1926 1797 1873 2002 1840 1815 1791 1875 1865 1795 1858 1937 2015 1956 1884 1960 1982 1995 2017 1912 1807 1860 1869 1919 1850 1810 1772 2005 1915 1777 1930 1882 179...

output:

1657107
1 3
1 5
1 9
1 28
1 33
1 53
1 83
1 92
1 93
1 96
1 102
1 105
1 124
1 125
1 131
1 133
1 146
1 152
1 161
1 164
1 192
1 223
1 228
1 248
1 251
1 254
1 271
1 292
1 298
1 311
1 316
1 340
1 349
1 351
1 364
1 371
1 381
1 391
1 406
1 416
1 455
1 468
1 469
1 470
1 486
1 511
1 525
1 532
1 545
1 567
1 574...

result:

ok T=1

Test #72:

score: 0
Accepted
time: 411ms
memory: 21448kb

input:

1
2021
1879 1917 1999 1910 1854 1852 1977 2014 1844 1900 1937 1864 1836 1920 1821 1876 2004 1840 1996 2015 1894 1968 1853 1985 1962 1913 1804 2010 1939 1994 2006 1924 1849 1873 1786 1934 1922 1842 1845 1829 1931 1893 1863 1785 1941 2007 1912 1797 1795 1790 1891 1945 1885 1952 1833 2009 1823 2003 188...

output:

1656323
1 5
1 6
1 9
1 13
1 15
1 27
1 35
1 44
1 62
1 72
1 74
1 90
1 96
1 100
1 120
1 141
1 150
1 158
1 166
1 176
1 198
1 203
1 222
1 227
1 242
1 256
1 284
1 286
1 304
1 317
1 347
1 361
1 363
1 374
1 381
1 398
1 417
1 426
1 431
1 451
1 455
1 465
1 485
1 498
1 503
1 525
1 539
1 552
1 575
1 576
1 583
1 ...

result:

ok T=1

Test #73:

score: 0
Accepted
time: 396ms
memory: 21384kb

input:

1
2021
1890 1893 1956 1925 1859 1949 1825 1995 1827 1844 1894 1914 1839 1957 2017 1828 1953 1809 1879 2020 1810 1940 1853 2000 1954 1849 1800 2007 1964 1812 2004 1900 1821 1906 1855 1937 1871 1933 1845 1968 1973 1869 1936 1851 1888 1880 2005 2012 1986 1807 1916 2014 1981 1872 1779 1777 1942 1930 178...

output:

1652077
1 5
1 7
1 18
1 27
1 55
1 56
1 62
1 74
1 88
1 92
1 101
1 108
1 109
1 111
1 143
1 157
1 167
1 205
1 211
1 213
1 215
1 228
1 238
1 239
1 259
1 272
1 288
1 317
1 323
1 332
1 340
1 366
1 396
1 397
1 407
1 417
1 427
1 431
1 459
1 474
1 479
1 510
1 524
1 526
1 551
1 557
1 560
1 572
1 580
1 591
1 59...

result:

ok T=1

Test #74:

score: 0
Accepted
time: 398ms
memory: 19880kb

input:

1
2021
1917 2001 1983 2002 1944 1832 1991 1838 1967 1921 1827 1941 1976 1884 1879 1852 1888 1933 1831 1898 2015 1860 1911 1826 1958 1808 1993 1815 1828 1971 1802 1807 1968 1859 1978 1851 1846 1883 1874 1977 1818 1870 1799 1844 1861 1789 1878 1781 1864 1949 1957 1777 1894 1973 1877 1814 1768 1938 181...

output:

1654371
1 6
1 11
1 24
1 26
1 31
1 43
1 46
1 48
1 52
1 57
1 64
1 80
1 98
1 139
1 141
1 147
1 155
1 168
1 193
1 208
1 209
1 229
1 230
1 231
1 243
1 258
1 269
1 277
1 287
1 297
1 298
1 300
1 314
1 322
1 343
1 344
1 354
1 361
1 373
1 395
1 399
1 406
1 407
1 418
1 430
1 440
1 443
1 452
1 469
1 491
1 514
...

result:

ok T=1

Test #75:

score: 0
Accepted
time: 405ms
memory: 20100kb

input:

1
2021
1897 1907 1831 1945 1963 1962 1844 1950 1995 1886 2017 1900 1911 1832 2010 1807 1912 1902 1918 1946 1971 1982 1836 1915 2016 1880 1871 1904 1961 1861 1906 1938 1913 1947 1787 1788 1842 1922 1858 1828 1866 1998 2020 1973 1834 1856 1872 1786 1881 1954 2012 1956 1940 1976 1863 1969 1931 1835 184...

output:

1652421
1 3
1 16
1 35
1 48
1 65
1 68
1 76
1 87
1 89
1 110
1 119
1 120
1 135
1 148
1 173
1 191
1 197
1 205
1 209
1 216
1 228
1 240
1 242
1 258
1 263
1 264
1 281
1 291
1 293
1 308
1 328
1 329
1 333
1 339
1 353
1 372
1 377
1 380
1 399
1 413
1 420
1 432
1 450
1 465
1 490
1 504
1 522
1 539
1 567
1 588
1 ...

result:

ok T=1

Test #76:

score: 0
Accepted
time: 396ms
memory: 20004kb

input:

1
2021
1923 2015 1926 1889 1847 1979 2011 1883 1954 1895 1897 1815 1845 1960 1920 1965 1846 1893 1824 1994 2002 1834 1804 1891 1966 1973 1862 1972 1961 1886 1830 2016 1927 1968 1911 1836 1817 1894 1819 1971 1990 1915 1813 1922 1875 1988 1775 1925 1876 1869 1860 1821 1829 1938 2008 1797 1959 1844 194...

output:

1654498
1 4
1 5
1 12
1 23
1 47
1 67
1 79
1 84
1 108
1 136
1 140
1 147
1 158
1 167
1 169
1 185
1 186
1 197
1 209
1 220
1 226
1 239
1 257
1 269
1 276
1 281
1 289
1 310
1 311
1 330
1 345
1 353
1 356
1 381
1 389
1 391
1 397
1 403
1 433
1 440
1 454
1 460
1 477
1 489
1 492
1 507
1 520
1 527
1 537
1 539
1 ...

result:

ok T=1

Test #77:

score: 0
Accepted
time: 413ms
memory: 20724kb

input:

1
2021
1881 1945 1954 1966 1866 1974 1907 1928 1982 1838 1921 1908 2004 1909 1941 1809 1871 1862 1978 2008 1840 1888 1930 1846 1970 1933 1808 1927 1892 2003 1957 1886 1984 1899 1922 2016 1814 1800 1804 1913 1824 1848 2011 1915 1980 1967 1997 1999 1961 1943 1789 1798 1875 1986 1788 1833 1852 1965 176...

output:

1661376
1 5
1 10
1 16
1 27
1 38
1 51
1 55
1 59
1 73
1 85
1 88
1 98
1 121
1 126
1 134
1 138
1 149
1 151
1 169
1 186
1 193
1 204
1 209
1 213
1 240
1 255
1 258
1 276
1 305
1 309
1 324
1 325
1 354
1 355
1 380
1 381
1 384
1 398
1 424
1 440
1 448
1 453
1 463
1 496
1 502
1 507
1 514
1 519
1 539
1 557
1 563...

result:

ok T=1

Test #78:

score: 0
Accepted
time: 399ms
memory: 20844kb

input:

1
2021
1873 1822 1853 1972 1949 1823 1840 1814 1956 1968 1862 1953 1946 1978 1829 1857 1815 2018 2006 1923 1833 1846 1958 1835 2014 1919 1800 2015 1809 1915 1938 1852 2003 1817 1791 1819 1844 1881 1856 1878 1947 1917 1922 1777 1799 1811 1870 1980 1877 1792 1890 1924 2002 1984 1785 1932 1914 1869 176...

output:

1648366
1 2
1 8
1 27
1 35
1 44
1 59
1 66
1 69
1 80
1 90
1 97
1 111
1 118
1 122
1 123
1 131
1 148
1 154
1 158
1 170
1 176
1 187
1 209
1 239
1 250
1 264
1 278
1 296
1 301
1 307
1 333
1 340
1 351
1 357
1 358
1 393
1 394
1 406
1 416
1 430
1 458
1 492
1 498
1 537
1 570
1 582
1 592
1 602
1 610
1 625
1 632...

result:

ok T=1

Test #79:

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

input:

1
2021
1894 1945 1969 1854 1844 1856 1948 2016 1986 1875 1913 2000 2007 1937 1823 1988 1873 1806 1927 1816 1850 1801 1934 1883 1849 1981 1968 1987 1928 1997 1871 1811 1923 1991 1893 1983 1857 1962 1936 1845 1902 1864 1859 1985 2019 1992 1790 1869 1832 1867 1930 1792 1974 1797 1818 1989 1903 1815 192...

output:

1656674
1 4
1 5
1 15
1 18
1 22
1 47
1 60
1 76
1 111
1 114
1 133
1 170
1 195
1 207
1 208
1 217
1 229
1 238
1 258
1 268
1 281
1 288
1 299
1 308
1 309
1 314
1 325
1 337
1 348
1 361
1 380
1 391
1 394
1 398
1 409
1 424
1 429
1 451
1 458
1 463
1 482
1 490
1 493
1 495
1 500
1 535
1 540
1 546
1 557
1 565
1 ...

result:

ok T=1

Test #80:

score: 0
Accepted
time: 398ms
memory: 21364kb

input:

1
2021
1952 1991 1988 2001 1916 1824 1898 1994 1901 1882 1871 1890 1870 1923 2013 1855 2021 1957 1985 1818 1822 1951 2020 2006 2016 1845 1834 1968 2002 1814 1983 1809 1812 1979 1921 1899 1801 1973 1980 1986 1954 1934 1860 1802 1811 1924 1829 1821 1859 1982 2008 1908 1942 1858 1929 2007 2019 1984 178...

output:

1659104
1 5
1 6
1 20
1 30
1 32
1 37
1 59
1 64
1 71
1 76
1 97
1 128
1 134
1 149
1 151
1 169
1 181
1 192
1 193
1 199
1 213
1 234
1 248
1 275
1 284
1 298
1 308
1 310
1 316
1 317
1 349
1 373
1 388
1 409
1 413
1 426
1 428
1 460
1 478
1 486
1 489
1 492
1 494
1 499
1 505
1 511
1 531
1 538
1 539
1 550
1 569...

result:

ok T=1

Test #81:

score: 0
Accepted
time: 413ms
memory: 21064kb

input:

1
2021
1899 2009 1942 1948 1907 1979 1977 1852 1876 1904 1941 1976 1896 2014 1850 1921 1988 1958 1865 1868 1837 1957 1827 1991 1841 1881 1952 1801 1968 1834 1897 1916 1804 1835 1910 1889 2019 1970 1822 1796 1867 1866 2013 1870 1869 1860 1971 2011 1788 1927 1862 1816 1783 1797 1920 1857 1945 2017 182...

output:

1664382
1 8
1 15
1 21
1 23
1 28
1 40
1 49
1 53
1 70
1 92
1 96
1 116
1 131
1 157
1 158
1 165
1 174
1 180
1 191
1 216
1 222
1 231
1 249
1 252
1 265
1 281
1 289
1 313
1 314
1 315
1 331
1 364
1 369
1 380
1 384
1 394
1 403
1 419
1 427
1 461
1 462
1 463
1 477
1 488
1 496
1 509
1 518
1 519
1 527
1 545
1 55...

result:

ok T=1

Test #82:

score: 0
Accepted
time: 408ms
memory: 20988kb

input:

1
2021
1903 1864 1831 1874 1967 2013 1917 1893 1865 1945 1869 1983 1884 1850 1913 1975 1826 1920 1845 1989 1879 1833 1916 1969 1875 1980 1861 1902 1961 1812 1908 1800 1794 2019 2011 1941 1829 1886 1866 1921 1809 1820 1939 1876 1787 1894 1951 1835 1852 1797 2000 2005 1973 1788 1888 1935 1949 1911 176...

output:

1661749
1 2
1 3
1 17
1 30
1 32
1 33
1 45
1 59
1 87
1 92
1 113
1 116
1 134
1 139
1 141
1 161
1 187
1 196
1 216
1 227
1 241
1 243
1 248
1 250
1 260
1 267
1 288
1 289
1 291
1 301
1 321
1 336
1 355
1 362
1 393
1 404
1 410
1 435
1 445
1 454
1 455
1 466
1 484
1 494
1 514
1 521
1 533
1 558
1 560
1 563
1 56...

result:

ok T=1

Test #83:

score: 0
Accepted
time: 487ms
memory: 21192kb

input:

1
2021
2018 2020 2010 2001 2000 2007 2021 1996 2008 2002 1992 1995 2013 2011 2019 2015 1986 2004 1993 2006 2009 2012 2016 1982 2014 1989 1987 1990 1983 1975 2003 1981 1984 1997 1970 1988 1980 2005 1979 1977 1978 1976 1967 1972 1971 1961 1966 1969 1974 1968 1994 1991 1957 1985 1955 1948 1963 1965 195...

output:

2003456
1 3
1 4
1 5
1 8
1 11
1 17
1 24
1 30
1 35
1 43
1 46
1 53
1 55
1 56
1 68
1 70
1 78
1 80
1 82
1 91
1 99
1 100
1 103
1 109
1 110
1 112
1 113
1 119
1 122
1 124
1 127
1 128
1 135
1 136
1 138
1 143
1 144
1 146
1 154
1 155
1 160
1 169
1 172
1 176
1 182
1 183
1 187
1 188
1 190
1 200
1 203
1 209
1 210...

result:

ok T=1

Test #84:

score: 0
Accepted
time: 482ms
memory: 20312kb

input:

1
2021
2014 2015 2012 2011 2003 2004 2013 2020 2001 2017 2009 2005 1990 1993 1994 1995 1992 2002 2000 2021 1998 1983 2006 1981 1979 1988 1986 1978 2008 1973 1984 2016 1972 1975 1969 1996 1987 1966 1968 1964 2019 1967 2010 1963 1980 1961 1970 1971 1991 1954 1952 1976 1985 1949 1999 1977 1962 1956 201...

output:

2003296
1 3
1 4
1 5
1 9
1 13
1 22
1 24
1 25
1 28
1 30
1 33
1 35
1 38
1 40
1 44
1 46
1 50
1 51
1 54
1 62
1 70
1 75
1 77
1 78
1 85
1 86
1 92
1 99
1 101
1 102
1 104
1 107
1 112
1 117
1 119
1 125
1 128
1 131
1 138
1 140
1 144
1 146
1 154
1 158
1 159
1 164
1 167
1 171
1 176
1 179
1 184
1 188
1 189
1 197
...

result:

ok T=1

Test #85:

score: 0
Accepted
time: 473ms
memory: 20004kb

input:

1
2021
2021 2001 2011 2006 1998 2004 2009 1997 1999 2013 2015 1991 2014 1994 2019 1988 1993 2016 2000 1992 2003 2008 1980 1984 1987 2010 1981 1995 1982 2007 1974 1996 1975 2002 2020 1985 1989 1969 2005 1971 1965 1962 2012 1979 1968 1990 1966 1957 1963 1956 1964 1977 2017 1953 1954 1951 1961 2018 197...

output:

2003732
1 2
1 5
1 8
1 12
1 16
1 23
1 31
1 38
1 41
1 42
1 48
1 50
1 54
1 56
1 61
1 62
1 71
1 72
1 76
1 81
1 84
1 88
1 91
1 97
1 99
1 102
1 103
1 105
1 107
1 109
1 110
1 114
1 115
1 120
1 127
1 130
1 139
1 142
1 145
1 147
1 155
1 161
1 162
1 167
1 168
1 169
1 174
1 175
1 181
1 188
1 192
1 200
1 205
1 ...

result:

ok T=1

Test #86:

score: 0
Accepted
time: 496ms
memory: 20632kb

input:

1
2021
2021 2004 2001 2012 2019 2005 2016 2002 2017 2000 2015 2013 2018 1995 2009 1994 1999 2014 1987 2007 1991 1997 1981 2003 2008 1990 1992 1985 1988 2006 1980 1983 1996 1986 2020 1975 1984 1971 1967 1966 1998 1961 1964 1974 1960 1958 1962 1959 2010 1978 1956 1963 1977 1949 1969 1952 2011 1976 194...

output:

2002580
1 2
1 3
1 10
1 14
1 16
1 19
1 23
1 31
1 36
1 38
1 39
1 40
1 42
1 45
1 46
1 51
1 54
1 59
1 62
1 64
1 68
1 75
1 76
1 83
1 84
1 91
1 93
1 95
1 99
1 100
1 104
1 111
1 117
1 118
1 125
1 127
1 133
1 138
1 141
1 143
1 146
1 149
1 151
1 155
1 159
1 161
1 169
1 170
1 173
1 181
1 187
1 191
1 194
1 198...

result:

ok T=1

Test #87:

score: 0
Accepted
time: 481ms
memory: 20296kb

input:

1
2021
2016 2014 2004 2011 2008 1998 2013 2002 1994 2017 2015 2010 2007 1996 2003 1992 2005 2000 1986 1999 1993 1987 2018 2009 1979 1985 1991 2012 1978 1997 2020 1984 2019 1973 1988 1995 2021 1974 1980 1989 1983 1976 1970 1965 2001 1971 1966 1957 1958 1961 1964 1954 1956 1953 1975 1977 1955 1982 194...

output:

2003483
1 2
1 3
1 6
1 9
1 16
1 19
1 25
1 29
1 34
1 43
1 44
1 48
1 52
1 54
1 59
1 61
1 66
1 68
1 71
1 72
1 73
1 78
1 82
1 91
1 93
1 95
1 97
1 101
1 102
1 103
1 111
1 116
1 119
1 123
1 124
1 130
1 133
1 139
1 141
1 142
1 148
1 150
1 155
1 160
1 163
1 174
1 175
1 177
1 182
1 184
1 185
1 191
1 194
1 201...

result:

ok T=1

Test #88:

score: 0
Accepted
time: 482ms
memory: 19804kb

input:

1
2021
2016 2002 2017 2018 1998 2011 2013 2010 1997 1994 2015 1996 2012 2003 1992 1999 1991 1990 1993 1995 1984 2019 2005 2007 1985 1979 1989 2006 1976 1978 2000 1977 2009 1983 1980 1969 1988 1968 1967 1981 2004 1970 1982 1962 1960 1965 2008 1987 1957 1973 1954 1963 1975 1986 1955 2014 1972 1958 194...

output:

2002594
1 2
1 5
1 9
1 10
1 15
1 17
1 18
1 21
1 26
1 29
1 36
1 38
1 39
1 44
1 45
1 49
1 51
1 59
1 62
1 66
1 76
1 78
1 82
1 84
1 92
1 97
1 98
1 101
1 105
1 107
1 112
1 117
1 119
1 122
1 128
1 130
1 134
1 136
1 142
1 145
1 148
1 149
1 150
1 158
1 163
1 165
1 167
1 169
1 175
1 186
1 187
1 188
1 191
1 19...

result:

ok T=1

Test #89:

score: 0
Accepted
time: 472ms
memory: 21412kb

input:

1
2021
2012 2016 2020 2001 2018 2004 2017 2011 1995 2010 1993 2006 1997 2000 2013 2008 2009 1987 1988 2019 1986 1992 1980 2007 1985 1994 1976 1982 1990 2021 1972 1974 2015 1978 1984 1983 1991 1970 1964 1968 1967 1965 2002 1999 1989 1958 2003 1996 1954 1963 1962 1979 1961 1953 1969 2014 1956 1959 195...

output:

2002463
1 4
1 9
1 11
1 18
1 21
1 23
1 27
1 31
1 38
1 39
1 46
1 49
1 54
1 59
1 62
1 63
1 70
1 72
1 73
1 76
1 78
1 86
1 87
1 92
1 99
1 101
1 104
1 105
1 106
1 109
1 112
1 116
1 122
1 123
1 125
1 128
1 130
1 135
1 140
1 150
1 155
1 158
1 163
1 168
1 169
1 174
1 175
1 178
1 179
1 180
1 183
1 187
1 190
1...

result:

ok T=1

Test #90:

score: 0
Accepted
time: 478ms
memory: 20176kb

input:

1
2021
2019 2003 2018 2020 2008 2017 2013 1995 2016 2011 2009 1996 2004 1997 1998 2007 2021 1989 2000 1986 1988 2014 2015 1994 1999 1993 1991 1982 1980 2002 2012 1987 2005 1973 1972 1970 1978 2001 1965 1967 1964 2010 1976 1990 1961 1962 1977 1992 1985 1974 1966 1983 1952 1953 1971 1979 1955 1981 194...

output:

2002990
1 2
1 8
1 18
1 20
1 28
1 29
1 34
1 35
1 36
1 39
1 41
1 45
1 53
1 59
1 62
1 64
1 69
1 71
1 72
1 74
1 76
1 77
1 81
1 88
1 89
1 96
1 97
1 99
1 100
1 103
1 111
1 114
1 123
1 124
1 128
1 131
1 134
1 140
1 147
1 150
1 151
1 152
1 163
1 165
1 170
1 173
1 176
1 177
1 180
1 184
1 190
1 192
1 197
1 20...

result:

ok T=1

Test #91:

score: 0
Accepted
time: 490ms
memory: 20832kb

input:

1
2021
2015 2013 2000 2009 1999 2005 2018 2019 2010 2011 2002 2001 2007 2012 2020 1991 2004 1987 1995 1998 1982 1986 2008 1997 1988 1996 2003 2014 1989 2017 1979 1976 1977 1980 1990 2016 2006 1971 1985 1974 2021 1975 1993 1992 1973 1978 1957 1972 1983 1956 1967 1959 1952 1961 1948 1955 1950 1994 196...

output:

2003243
1 2
1 3
1 5
1 16
1 18
1 21
1 31
1 32
1 38
1 47
1 50
1 53
1 55
1 63
1 65
1 66
1 73
1 75
1 76
1 80
1 81
1 86
1 89
1 90
1 92
1 98
1 104
1 108
1 114
1 115
1 116
1 117
1 125
1 130
1 132
1 138
1 142
1 150
1 151
1 157
1 160
1 165
1 169
1 170
1 175
1 178
1 180
1 184
1 190
1 193
1 195
1 198
1 200
1 2...

result:

ok T=1

Test #92:

score: 0
Accepted
time: 503ms
memory: 20072kb

input:

1
2021
2014 2015 2011 2016 2003 2010 1997 2004 2008 2000 1998 1991 2009 1999 1988 2020 1990 1989 2005 2021 2001 2006 1994 2007 1992 1995 1982 2002 1983 1996 1984 1981 2017 1975 2018 1970 1968 1974 1985 2013 1979 1986 1963 2012 1987 1978 1961 1958 1966 1962 1971 1973 1964 1965 1980 1969 1949 1946 196...

output:

2002695
1 3
1 5
1 7
1 12
1 15
1 27
1 32
1 34
1 36
1 37
1 43
1 47
1 48
1 57
1 58
1 63
1 67
1 70
1 76
1 80
1 82
1 87
1 93
1 94
1 97
1 102
1 105
1 109
1 111
1 116
1 117
1 118
1 123
1 125
1 134
1 135
1 138
1 139
1 144
1 147
1 149
1 152
1 154
1 157
1 158
1 161
1 168
1 173
1 180
1 183
1 187
1 190
1 193
1 ...

result:

ok T=1

Test #93:

score: 0
Accepted
time: 482ms
memory: 21152kb

input:

1
2021
2004 2006 2020 1999 2002 2017 2000 2018 1997 1995 2016 1998 1994 1989 1993 1996 1988 2019 2003 1987 1990 1985 2013 2001 2010 1984 1992 1981 1974 2015 1983 1978 1972 2007 2014 1976 1967 1977 1982 1980 1979 1991 1965 1963 1975 1958 1961 1960 1959 1986 1955 1973 1953 1957 1971 1951 1962 1946 195...

output:

2003343
1 4
1 9
1 10
1 13
1 14
1 17
1 20
1 22
1 26
1 28
1 29
1 33
1 37
1 43
1 44
1 46
1 51
1 53
1 56
1 58
1 67
1 71
1 75
1 77
1 78
1 80
1 81
1 91
1 93
1 94
1 100
1 101
1 106
1 116
1 118
1 120
1 121
1 125
1 126
1 131
1 133
1 140
1 146
1 150
1 154
1 164
1 169
1 172
1 175
1 178
1 179
1 182
1 187
1 191
...

result:

ok T=1

Test #94:

score: 0
Accepted
time: 487ms
memory: 19704kb

input:

1
2021
2008 2003 2000 2013 1998 2005 2004 2017 1996 2020 1993 1992 2015 2021 1990 1999 2007 1994 1984 1995 1987 1982 1980 2001 1979 1989 1985 2019 2012 1983 1977 1973 1988 2010 1978 2009 1986 1974 1969 1991 2002 1965 1960 1959 1958 1966 1961 1981 1957 1972 1962 2018 2011 1949 1950 1968 1963 2016 197...

output:

2003174
1 2
1 3
1 5
1 9
1 11
1 12
1 15
1 19
1 22
1 23
1 25
1 31
1 32
1 39
1 42
1 43
1 44
1 45
1 49
1 54
1 61
1 70
1 74
1 75
1 85
1 86
1 91
1 92
1 96
1 97
1 100
1 101
1 106
1 114
1 122
1 123
1 125
1 130
1 133
1 135
1 136
1 143
1 145
1 150
1 153
1 156
1 159
1 162
1 168
1 169
1 170
1 178
1 186
1 188
1 ...

result:

ok T=1

Test #95:

score: 0
Accepted
time: 482ms
memory: 19852kb

input:

1
2021
2006 2019 2010 1999 2012 2021 2015 1997 1994 1993 2017 2003 2013 2009 2008 1989 1986 2014 2020 2007 1992 1990 1995 1985 1982 1984 2002 2011 1974 2016 1998 1976 2018 1977 1979 2005 1987 1991 1964 1973 1963 2000 1960 1972 1961 1988 2001 1970 1975 1955 1971 1959 1952 1951 1958 1969 1953 1945 196...

output:

2003313
1 4
1 8
1 9
1 10
1 16
1 17
1 24
1 25
1 29
1 39
1 41
1 43
1 50
1 53
1 54
1 58
1 65
1 68
1 72
1 73
1 75
1 82
1 84
1 89
1 92
1 97
1 102
1 103
1 109
1 112
1 115
1 116
1 126
1 130
1 136
1 138
1 140
1 143
1 147
1 151
1 155
1 157
1 165
1 167
1 168
1 173
1 178
1 183
1 188
1 192
1 194
1 195
1 199
1 2...

result:

ok T=1

Test #96:

score: 0
Accepted
time: 494ms
memory: 20652kb

input:

1
2021
2019 2004 2011 2017 2009 2005 1999 2012 1996 1997 2020 1993 2007 2010 1991 1987 1988 2015 2003 1995 1990 2013 1986 1982 2001 1985 2002 1981 1984 1976 2016 1983 2021 1970 1975 1980 1974 1992 1967 1978 1962 1977 2000 1961 1998 1968 1958 2008 1957 1972 2014 1964 1979 1971 1989 2006 1966 1969 194...

output:

2003371
1 2
1 7
1 9
1 12
1 15
1 16
1 23
1 24
1 28
1 30
1 34
1 39
1 41
1 44
1 47
1 49
1 59
1 65
1 67
1 70
1 73
1 74
1 78
1 84
1 86
1 88
1 93
1 100
1 105
1 107
1 111
1 113
1 118
1 119
1 123
1 125
1 132
1 133
1 134
1 136
1 139
1 144
1 145
1 146
1 148
1 156
1 160
1 163
1 167
1 171
1 177
1 181
1 190
1 19...

result:

ok T=1

Test #97:

score: 0
Accepted
time: 470ms
memory: 20492kb

input:

1
2021
2003 2002 2001 1999 2017 2005 2011 1995 1998 1993 2008 2007 2004 1992 2000 1990 1994 1997 1996 1983 2015 2012 1989 1987 1979 1982 2019 2021 1975 1978 2014 1974 1991 2016 2020 1985 1977 2006 1986 1971 1976 2013 1960 2018 1964 1980 1958 1962 1955 1954 1988 1957 1953 1959 1968 1949 1967 1952 197...

output:

2002737
1 2
1 3
1 4
1 8
1 10
1 14
1 16
1 20
1 25
1 29
1 32
1 40
1 43
1 47
1 49
1 50
1 53
1 56
1 61
1 64
1 67
1 69
1 71
1 73
1 82
1 85
1 90
1 97
1 101
1 103
1 111
1 117
1 122
1 127
1 131
1 138
1 140
1 144
1 155
1 157
1 158
1 167
1 168
1 171
1 177
1 178
1 180
1 182
1 184
1 185
1 187
1 189
1 193
1 206
...

result:

ok T=1

Test #98:

score: 0
Accepted
time: 489ms
memory: 20984kb

input:

1
2021
2021 2020 2019 2018 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2001 2000 1999 1998 1997 1996 1995 1994 1993 1992 1991 1990 1989 1988 1987 1986 1985 1984 1983 1982 1981 1980 1979 1978 1977 1976 1975 1974 1973 1972 1971 1970 1969 1968 1967 1966 1965 1964 196...

output:

2041210
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
...

result:

ok T=1