QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#376749#6545. Connect the DotsWorld_CreaterAC ✓94ms21000kbC++142.3kb2024-04-04 16:14:472024-04-04 16:14:47

Judging History

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

  • [2024-04-04 16:14:47]
  • 评测
  • 测评结果:AC
  • 用时:94ms
  • 内存:21000kb
  • [2024-04-04 16:14:47]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m,a[200005],cnt[200005],lst[200005],nxt[200005],vis[200005];
priority_queue<pair<int,int> > q;
vector<pair<int,int> > ans;
bool checkadd(int x)
{
	if(!x) return 0;
	// cerr<<"Check:"<<x<<" "<<nxt[x]<<" "<<lst[x]<<" "<<a[nxt[x]]<<" "<<a[lst[x]]<<"\n";
	if(nxt[x]&&lst[x]&&a[nxt[x]]!=a[lst[x]])
	{
		// cerr<<"added"<<" "<<(-cnt[a[x]])<<"\n";
		q.emplace(-cnt[a[x]],x);
		return 1;
	}
	return 0;
}
void del(int x,int op)
{
	if(!x) return ;
	// cerr<<"delete:"<<x<<" "<<vis[x]<<"\n";
	if(vis[x]) return ;
	if(!op&&(!lst[x]||!nxt[x]||a[nxt[x]]==a[lst[x]])) return ;
	vis[x]=1;
	// cerr<<"deleted\n";
	cnt[a[x]]--;
	nxt[lst[x]]=nxt[x];
	lst[nxt[x]]=lst[x];
	checkadd(lst[x]);
	checkadd(nxt[x]);
	if(nxt[x]&&lst[x]&&a[nxt[x]]!=a[lst[x]]) ans.emplace_back(lst[x],nxt[x]);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		cin>>n>>m;
		nxt[0]=1;
		for(int i=1;i<=n;i++)
		{
			cin>>a[i];
			cnt[a[i]]++;
			lst[i]=i-1;
			nxt[i]=(i+1)%(n+1);
			if(i>1&&a[i]!=a[i-1]) ans.emplace_back(i-1,i);
		}
		for(int i=1;i<=n;i++) checkadd(i);
		q.emplace(-(n+1),n+1);
		while(!q.empty())
		{
			auto [y,x]=q.top();
			// cerr<<x<<" "<<y<<"\n";
			if(x==n+1&&nxt[nxt[nxt[0]]])
			{
				// assert(q.size()==1);
				// for(int i=nxt[0];i;i=nxt[i])
				// {
				// 	// cerr<<a[i]<<" ";
				// 	assert(nxt[lst[i]]==i);
				// }
				// // cerr<<"\n";
				// for(int i=nxt[0];i;i=nxt[i])
				// {
				// 	// cerr<<a[i]<<" "<<a[lst[i]]<<","<<a[nxt[i]]<<"\n";
				// 	// assert(!checkadd(i));
				// }
				// // cerr<<"\n";
				// // cerr<<"SDHISHD:"<<nxt[nxt[0]]<<" "<<"\n";
				del(nxt[nxt[0]],1);
				continue ;
			}
			q.pop();
			if(x==n+1) continue ;
			if(vis[x]) continue ;
			if(cnt[a[x]]==1)
			{
				for(int i=lst[x];lst[i];i=lst[i]) del(i,0);
				for(int i=nxt[x];nxt[i];i=nxt[i]) del(i,0);
				del(x,0);
				break ;
			}
			del(x,0);
			// for(int i=nxt[0];i;i=nxt[i]) checkadd(i);
			// for(int i=1;i<=n;i++) checkadd(i);
		}
		cout<<ans.size()<<"\n";
		for(auto [l,r]:ans)
		{
			cout<<l<<" "<<r<<"\n";
		}
		while(!q.empty()) q.pop();
		ans.clear();
		for(int i=1;i<=n;i++)
		{
			cnt[a[i]]=0;
			vis[i]=0;
		}
	}
}

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

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5684kb

input:

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

output:

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

result:

ok all 3 test passed

Test #2:

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

input:

1
2 2
1 2

output:

1
1 2

result:

ok all 1 test passed

Test #3:

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

input:

10
5 2
2 2 2 1 2
5 2
2 1 2 1 2
5 2
1 2 2 2 1
5 2
2 1 2 1 1
5 2
1 1 1 2 1
5 2
1 2 2 1 2
5 2
2 1 1 2 2
5 2
2 2 2 1 1
5 2
1 1 2 1 2
5 2
1 2 2 2 1

output:

4
3 4
4 5
2 4
1 4
5
1 2
2 3
3 4
4 5
1 4
4
1 2
4 5
3 5
2 5
5
1 2
2 3
3 4
3 5
1 5
4
3 4
4 5
2 4
1 4
5
1 2
3 4
4 5
2 4
1 5
4
1 2
3 4
2 4
2 5
4
3 4
3 5
2 5
1 5
5
2 3
3 4
4 5
1 3
1 5
4
1 2
4 5
3 5
2 5

result:

ok all 10 test passed

Test #4:

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

input:

10
7 2
1 2 1 1 1 2 1
7 2
1 1 2 1 2 1 2
7 2
2 2 1 1 2 1 1
7 2
1 1 1 2 2 1 1
7 2
1 2 2 1 2 2 1
7 2
2 1 2 2 2 2 1
7 2
1 2 1 2 2 2 2
7 2
2 2 1 2 1 2 1
7 2
2 1 1 2 1 2 2
7 2
2 2 1 2 1 1 2

output:

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

result:

ok all 10 test passed

Test #5:

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

input:

10
9 2
1 1 1 2 1 2 2 1 2
9 2
1 2 1 1 2 2 2 2 1
9 2
2 1 2 1 1 2 1 2 1
9 2
1 1 2 1 1 1 1 2 2
9 2
1 1 2 2 1 2 1 2 2
9 2
2 2 1 2 1 2 2 2 2
9 2
1 1 2 2 2 1 2 1 2
9 2
1 1 2 1 1 2 2 2 2
9 2
1 1 1 1 2 1 1 2 1
9 2
2 1 2 2 1 1 2 2 1

output:

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

result:

ok all 10 test passed

Test #6:

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

input:

1
5 2
1 1 2 2 1

output:

4
2 3
4 5
3 5
1 3

result:

ok all 1 test passed

Test #7:

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

input:

1
7 2
2 1 1 2 1 1 2

output:

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

result:

ok all 1 test passed

Test #8:

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

input:

1
9 2
2 1 1 2 1 1 1 2 2

output:

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

result:

ok all 1 test passed

Test #9:

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

input:

4
20 2
2 1 1 2 1 2 1 1 2 1 1 1 1 2 2 2 1 1 2 2
20 2
2 1 2 2 2 1 1 2 2 2 1 2 2 2 2 1 2 2 1 2
20 2
2 2 1 1 2 2 1 1 1 1 1 2 1 1 2 2 1 2 1 1
20 2
2 1 2 2 2 1 2 2 1 1 1 2 1 2 2 1 2 1 1 2

output:

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

result:

ok all 4 test passed

Test #10:

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

input:

4
100 2
2 2 2 1 2 1 1 1 1 2 2 1 2 2 2 1 2 2 2 2 1 1 1 2 2 1 1 2 1 1 2 1 2 2 1 1 1 2 1 2 1 1 2 1 2 1 2 1 2 1 1 1 1 2 1 1 1 2 2 2 1 2 2 2 1 1 1 2 1 2 1 2 2 1 2 2 1 1 2 1 1 1 1 2 2 1 2 1 1 2 2 1 2 2 1 2 1 2 2 2
100 2
2 1 1 1 1 1 2 2 2 1 2 1 2 2 1 2 2 1 1 1 1 2 1 1 1 2 2 1 1 2 1 1 2 1 1 2 1 1 1 1 1 2 1 ...

output:

126
3 4
4 5
5 6
9 10
11 12
12 13
15 16
16 17
20 21
23 24
25 26
27 28
28 29
30 31
31 32
32 33
34 35
37 38
38 39
39 40
40 41
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
53 54
54 55
57 58
60 61
61 62
64 65
67 68
68 69
69 70
70 71
71 72
73 74
74 75
76 77
78 79
79 80
83 84
85 86
86 87
87 88
89 90
91 ...

result:

ok all 4 test passed

Test #11:

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

input:

1
100 2
2 2 1 1 2 2 2 1 1 2 1 1 1 2 2 1 2 2 2 1 1 2 2 1 1 2 2 2 1 2 1 1 2 1 1 2 2 1 2 1 1 2 1 2 2 1 2 2 2 2 1 2 1 2 1 1 2 1 1 1 1 1 2 2 2 1 1 2 1 2 2 2 2 1 1 2 2 2 1 1 2 2 2 1 2 2 1 2 1 2 1 2 2 2 1 2 2 2 1 1

output:

125
2 3
4 5
7 8
9 10
10 11
13 14
15 16
16 17
19 20
21 22
23 24
25 26
28 29
29 30
30 31
32 33
33 34
35 36
37 38
38 39
39 40
41 42
42 43
43 44
45 46
46 47
50 51
51 52
52 53
53 54
54 55
56 57
57 58
62 63
65 66
67 68
68 69
69 70
73 74
75 76
78 79
80 81
83 84
84 85
86 87
87 88
88 89
89 90
90 91
91 92
94 ...

result:

ok all 1 test passed

Test #12:

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

input:

1
100 2
1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1

output:

123
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
98 1...

result:

ok all 1 test passed

Test #13:

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

input:

1
200 2
1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 ...

output:

208
3 4
13 14
23 24
33 34
43 44
53 54
63 64
73 74
83 84
93 94
103 104
113 114
123 124
133 134
143 144
153 154
163 164
173 174
183 184
193 194
193 195
193 196
193 197
193 198
193 199
193 200
192 200
191 200
190 200
189 200
188 200
187 200
186 200
185 200
184 200
182 184
181 184
180 184
179 184
178 18...

result:

ok all 1 test passed

Test #14:

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

input:

4
7 3
2 2 3 1 3 1 1
7 3
3 1 2 2 3 1 3
7 3
2 1 3 3 2 3 2
7 3
3 2 3 1 3 1 3

output:

9
2 3
3 4
4 5
5 6
2 4
1 4
5 7
1 5
1 7
9
1 2
2 3
4 5
5 6
6 7
3 5
1 3
3 6
3 7
9
1 2
2 3
4 5
5 6
6 7
2 4
2 5
2 6
2 7
10
1 2
2 3
3 4
4 5
5 6
6 7
2 4
2 5
2 6
2 7

result:

ok all 4 test passed

Test #15:

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

input:

4
20 3
1 2 3 1 3 2 1 1 2 3 1 2 2 1 1 2 2 1 2 2
20 3
1 2 1 2 3 3 2 1 1 3 3 2 2 1 2 3 1 1 2 2
20 3
3 1 1 3 3 1 3 2 1 1 2 3 3 3 1 1 2 1 1 1
20 3
3 2 2 1 3 1 1 3 3 2 2 2 1 1 2 1 2 2 2 2

output:

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

result:

ok all 4 test passed

Test #16:

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

input:

4
100 3
1 3 3 2 1 1 1 1 3 1 1 2 2 3 2 3 3 1 1 1 1 1 3 2 2 3 2 1 3 3 3 1 1 2 3 1 2 1 2 3 2 1 2 2 2 3 2 3 3 2 3 1 1 2 3 1 3 1 3 3 2 1 1 3 3 1 2 2 2 2 3 1 2 3 3 3 3 2 3 1 3 1 2 1 1 3 2 1 2 1 1 1 1 1 1 3 2 1 3 1
100 3
2 1 3 3 1 3 3 3 1 2 1 1 2 3 1 1 1 2 3 2 3 3 3 2 2 1 2 2 2 1 1 1 1 2 3 3 2 3 1 3 1 3 3 ...

output:

162
1 2
3 4
4 5
8 9
9 10
11 12
13 14
14 15
15 16
17 18
22 23
23 24
25 26
26 27
27 28
28 29
31 32
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
45 46
46 47
47 48
49 50
50 51
51 52
53 54
54 55
55 56
56 57
57 58
58 59
60 61
61 62
63 64
65 66
66 67
70 71
71 72
72 73
73 74
77 78
78 79
79 80...

result:

ok all 4 test passed

Test #17:

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

input:

1
200 3
1 3 3 3 2 3 3 3 1 3 3 3 1 3 1 1 2 2 2 3 2 2 3 3 2 2 2 1 3 1 3 1 3 3 1 1 1 2 2 1 2 1 3 3 3 3 3 1 2 1 1 1 3 3 3 1 1 2 2 1 1 3 2 3 2 1 3 3 1 1 3 1 2 1 2 2 2 1 3 2 2 1 3 1 2 3 2 2 1 2 1 3 3 3 2 1 1 3 3 2 2 3 2 3 3 1 2 3 1 2 2 3 2 2 1 2 2 1 2 3 1 2 2 3 1 2 3 1 2 1 1 3 1 3 1 3 2 1 3 2 1 2 2 1 3 2 ...

output:

331
1 2
4 5
5 6
8 9
9 10
12 13
13 14
14 15
16 17
19 20
20 21
22 23
24 25
27 28
28 29
29 30
30 31
31 32
32 33
34 35
37 38
39 40
40 41
41 42
42 43
47 48
48 49
49 50
52 53
55 56
57 58
59 60
61 62
62 63
63 64
64 65
65 66
66 67
68 69
70 71
71 72
72 73
73 74
74 75
77 78
78 79
79 80
81 82
82 83
83 84
84 85...

result:

ok all 1 test passed

Test #18:

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

input:

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

output:

11
1 2
2 3
3 4
4 5
5 6
6 7
4 6
3 6
2 6
1 6
1 7
11
1 2
2 3
3 4
4 5
5 6
6 7
4 6
3 6
2 6
1 6
1 7
11
1 2
2 3
3 4
4 5
5 6
6 7
4 6
3 6
2 6
1 6
1 7
11
1 2
2 3
3 4
4 5
5 6
6 7
4 6
3 6
2 6
1 6
1 7

result:

ok all 4 test passed

Test #19:

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

input:

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

output:

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

result:

ok all 4 test passed

Test #20:

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

input:

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

output:

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

result:

ok all 4 test passed

Test #21:

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

input:

1
200 200
77 83 76 63 45 147 185 154 69 89 78 59 118 39 161 48 165 99 120 68 74 159 162 43 168 30 82 199 101 103 33 61 31 34 180 88 149 3 71 114 166 64 145 23 15 54 97 111 75 72 38 112 129 122 107 148 79 25 2 13 109 10 60 173 20 44 117 94 175 26 121 93 153 151 172 108 194 73 140 135 57 18 164 171 13...

output:

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

result:

ok all 1 test passed

Test #22:

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

input:

4
20 4
2 2 4 3 1 2 1 3 2 2 1 3 3 4 4 3 2 2 2 3
20 4
3 3 3 1 1 3 2 2 2 2 1 4 4 2 1 4 3 4 4 3
20 4
1 1 3 4 3 3 1 3 1 4 2 1 1 2 2 4 3 4 4 2
20 4
3 4 3 3 1 4 4 2 2 2 4 1 1 3 4 3 4 2 2 3

output:

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

result:

ok all 4 test passed

Test #23:

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

input:

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

output:

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

result:

ok all 4 test passed

Test #24:

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

input:

1
300 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

299
35 36
185 186
185 187
185 188
185 189
185 190
185 191
185 192
185 193
185 194
185 195
185 196
185 197
185 198
185 199
185 200
185 201
185 202
185 203
185 204
185 205
185 206
185 207
185 208
185 209
185 210
185 211
185 212
185 213
185 214
185 215
185 216
185 217
185 218
185 219
185 220
185 221
18...

result:

ok all 1 test passed

Test #25:

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

input:

1
100 3
1 2 2 3 3 1 2 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 1 2 3 3 1 1 2 2 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1

output:

147
1 2
3 4
5 6
6 7
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
38 39
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
98 1...

result:

ok all 1 test passed

Test #26:

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

input:

1
100 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3

output:

100
30 31
64 65
97 98
97 99
97 100
96 100
95 100
94 100
93 100
92 100
91 100
90 100
89 100
88 100
87 100
86 100
85 100
84 100
83 100
82 100
81 100
80 100
79 100
78 100
77 100
76 100
75 100
74 100
73 100
72 100
71 100
70 100
69 100
68 100
67 100
66 100
65 100
63 65
62 65
61 65
60 65
59 65
58 65
57 65...

result:

ok all 1 test passed

Test #27:

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

input:

1
100 10
10 10 10 10 10 10 10 10 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10

output:

107
8 9
18 19
28 29
38 39
48 49
58 59
68 69
78 79
88 89
98 99
98 100
97 100
96 100
95 100
94 100
93 100
92 100
91 100
90 100
89 100
87 89
86 89
85 89
84 89
83 89
82 89
81 89
80 89
79 89
78 89
77 89
76 89
75 89
74 89
73 89
72 89
71 89
70 89
69 89
68 89
67 89
66 89
65 89
64 89
63 89
62 89
61 89
60 89
...

result:

ok all 1 test passed

Test #28:

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

input:

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

output:

449
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
29 30
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
93 94
94 95
96 97
98 9...

result:

ok all 1 test passed

Test #29:

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

input:

1
1000 2
2 1 1 2 2 1 1 1 1 2 2 2 2 1 1 1 1 2 1 1 2 2 1 1 1 2 1 1 1 2 1 2 2 2 1 1 1 2 2 1 2 1 2 1 2 2 2 1 1 2 1 2 1 2 1 1 2 1 2 1 2 2 1 2 2 2 2 2 1 2 2 1 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 1 2 1 2 1 1 2 1 1 2 2 2 1 1 1 2 1 1 2 1 1 2 2 2 2 2 2 1 1 1 2 2 1 2 2 1 1 2 2 1 1 1 2 2 1 2 2 2 2 1 2 1...

output:

1251
1 2
3 4
5 6
9 10
13 14
17 18
18 19
20 21
22 23
25 26
26 27
29 30
30 31
31 32
34 35
37 38
39 40
40 41
41 42
42 43
43 44
44 45
47 48
49 50
50 51
51 52
52 53
53 54
54 55
56 57
57 58
58 59
59 60
60 61
62 63
63 64
68 69
69 70
71 72
72 73
75 76
76 77
83 84
84 85
90 91
91 92
94 95
95 96
96 97
97 98
98...

result:

ok all 1 test passed

Test #30:

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

input:

1
3000 2
1 2 2 2 2 1 1 1 1 1 1 2 1 1 2 1 2 2 1 1 2 2 2 2 1 1 1 1 2 2 1 2 1 1 1 2 2 2 2 2 1 2 1 1 1 2 1 1 2 1 2 1 2 1 1 2 1 1 1 2 2 1 1 2 1 1 2 2 2 2 1 1 2 2 2 1 1 2 2 2 2 2 2 2 1 1 2 1 2 2 1 2 2 1 1 2 1 2 1 1 2 1 2 1 2 2 2 1 2 1 1 1 1 1 1 1 2 1 2 1 2 1 1 2 2 1 2 1 1 2 2 2 2 1 2 2 2 1 2 1 1 2 1 2 2 2...

output:

3766
1 2
5 6
11 12
12 13
14 15
15 16
16 17
18 19
20 21
24 25
28 29
30 31
31 32
32 33
35 36
40 41
41 42
42 43
45 46
46 47
48 49
49 50
50 51
51 52
52 53
53 54
55 56
56 57
59 60
61 62
63 64
64 65
66 67
70 71
72 73
75 76
77 78
84 85
86 87
87 88
88 89
90 91
91 92
93 94
95 96
96 97
97 98
98 99
100 101
101...

result:

ok all 1 test passed

Test #31:

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

input:

1
2000 2
2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2...

output:

2498
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 101
1...

result:

ok all 1 test passed

Test #32:

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

input:

1
1000 2
2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 2 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2...

output:

1050
10 11
20 21
30 31
40 41
50 51
52 53
53 54
60 61
70 71
80 81
90 91
100 101
110 111
120 121
130 131
140 141
150 151
160 161
170 171
180 181
190 191
200 201
210 211
220 221
230 231
240 241
250 251
260 261
270 271
280 281
290 291
300 301
310 311
320 321
330 331
340 341
350 351
360 361
370 371
380 3...

result:

ok all 1 test passed

Test #33:

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

input:

1
1000 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

999
96 97
596 597
596 598
596 599
596 600
596 601
596 602
596 603
596 604
596 605
596 606
596 607
596 608
596 609
596 610
596 611
596 612
596 613
596 614
596 615
596 616
596 617
596 618
596 619
596 620
596 621
596 622
596 623
596 624
596 625
596 626
596 627
596 628
596 629
596 630
596 631
596 632
59...

result:

ok all 1 test passed

Test #34:

score: 0
Accepted
time: 6ms
memory: 6060kb

input:

1
22000 2
1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 ...

output:

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

result:

ok all 1 test passed

Test #35:

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

input:

1
12000 2
2 1 1 2 2 1 2 1 1 2 1 1 1 2 1 2 1 1 2 2 1 1 2 2 2 2 1 2 1 2 1 1 1 1 2 2 2 2 2 1 1 2 1 1 1 1 1 1 1 1 1 2 2 1 2 2 1 2 1 2 1 1 1 1 1 2 1 2 1 1 2 1 1 2 1 2 2 1 1 2 1 1 2 2 2 2 1 1 1 2 1 1 2 1 2 2 1 1 2 2 1 1 2 2 1 2 2 2 2 1 2 2 2 2 2 2 1 1 1 2 2 2 2 2 1 1 2 1 2 1 2 1 1 1 2 1 2 1 1 2 1 2 2 2 2 ...

output:

14969
1 2
3 4
5 6
6 7
7 8
9 10
10 11
13 14
14 15
15 16
16 17
18 19
20 21
22 23
26 27
27 28
28 29
29 30
30 31
34 35
39 40
41 42
42 43
51 52
53 54
54 55
56 57
57 58
58 59
59 60
60 61
65 66
66 67
67 68
68 69
70 71
71 72
73 74
74 75
75 76
77 78
79 80
80 81
82 83
86 87
89 90
90 91
92 93
93 94
94 95
96 97...

result:

ok all 1 test passed

Test #36:

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

input:

1
300 150
21 91 61 3 124 47 39 37 35 86 28 74 50 79 125 146 38 32 60 111 114 29 103 121 126 55 61 47 149 9 149 124 92 29 78 104 54 34 54 27 1 59 44 123 9 36 29 25 124 88 125 145 113 137 119 108 27 132 124 114 143 143 77 97 84 83 40 132 77 62 72 37 51 139 56 80 34 87 69 131 100 57 120 148 42 42 123 2...

output:

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

result:

ok all 1 test passed

Test #37:

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

input:

1
1000 3
3 2 3 3 2 1 2 1 2 1 2 3 1 1 2 3 1 3 3 2 1 3 1 1 3 3 1 2 1 2 1 1 3 2 2 1 2 3 2 2 3 1 2 2 1 1 2 2 1 2 1 1 3 1 1 3 3 2 1 2 3 2 1 3 3 2 2 2 3 2 3 3 1 2 1 1 2 1 2 3 1 2 1 3 1 3 3 1 2 1 1 2 2 1 1 2 2 2 1 1 3 1 1 1 3 2 2 1 1 3 2 3 1 2 3 3 3 2 3 3 1 2 3 3 2 2 2 2 2 1 2 3 3 3 2 2 3 3 1 1 2 3 1 1 1 2...

output:

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

result:

ok all 1 test passed

Test #38:

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

input:

1
1000 30
18 16 27 2 30 22 9 1 20 18 30 3 14 23 2 12 10 6 30 3 14 24 10 18 20 18 24 3 28 27 8 25 22 23 13 28 3 8 4 22 30 23 21 4 7 27 23 16 24 23 15 9 18 23 1 12 25 23 18 14 21 25 25 4 30 23 17 28 17 23 13 2 14 3 29 27 12 15 29 11 9 23 8 17 17 27 14 11 15 25 11 19 13 16 3 2 22 2 2 29 6 14 12 20 13 2...

output:

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

result:

ok all 1 test passed

Test #39:

score: 0
Accepted
time: 7ms
memory: 6200kb

input:

1
30000 3
3 3 1 1 3 2 2 2 3 2 2 2 3 3 3 2 3 1 2 2 1 1 3 1 1 3 3 1 2 2 3 1 1 3 3 3 3 1 2 2 2 3 3 2 1 3 1 2 1 1 2 2 2 2 1 3 1 2 1 1 2 2 3 2 1 2 2 2 1 2 3 2 2 2 1 3 1 3 3 3 2 2 3 1 3 2 3 2 2 3 3 2 2 1 2 3 1 1 2 1 3 2 3 2 3 3 3 2 3 2 1 3 2 3 1 3 3 3 2 3 2 1 2 1 3 2 2 1 1 1 1 2 1 3 2 2 1 1 2 1 3 1 1 2 1 ...

output:

50050
2 3
4 5
5 6
8 9
9 10
12 13
15 16
16 17
17 18
18 19
20 21
22 23
23 24
25 26
27 28
28 29
30 31
31 32
33 34
37 38
38 39
41 42
43 44
44 45
45 46
46 47
47 48
48 49
50 51
54 55
55 56
56 57
57 58
58 59
60 61
62 63
63 64
64 65
65 66
68 69
69 70
70 71
71 72
74 75
75 76
76 77
77 78
80 81
82 83
83 84
84 ...

result:

ok all 1 test passed

Test #40:

score: 0
Accepted
time: 6ms
memory: 5860kb

input:

1
15000 3
1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 ...

output:

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

result:

ok all 1 test passed

Test #41:

score: 0
Accepted
time: 4ms
memory: 5920kb

input:

1
13998 3
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

13998
1263 1264
5929 5930
10595 10596
10595 10597
10595 10598
10595 10599
10595 10600
10595 10601
10595 10602
10595 10603
10595 10604
10595 10605
10595 10606
10595 10607
10595 10608
10595 10609
10595 10610
10595 10611
10595 10612
10595 10613
10595 10614
10595 10615
10595 10616
10595 10617
10595 1061...

result:

ok all 1 test passed

Test #42:

score: 0
Accepted
time: 5ms
memory: 6048kb

input:

1
10000 5000
1401 1401 1402 1402 1403 1403 1404 1404 1405 1405 1406 1406 1407 1407 1408 1408 1409 1409 1410 1410 1411 1411 1412 1412 1413 1413 1414 1414 1415 1415 1416 1416 1417 1417 1418 1418 1419 1419 1420 1420 1421 1421 1422 1422 1423 1423 1424 1424 1425 1425 1426 1426 1427 1427 1428 1428 1429 14...

output:

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

result:

ok all 1 test passed

Test #43:

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

input:

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

output:

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

result:

ok all 3 test passed

Test #44:

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

input:

1
2 2
1 2

output:

1
1 2

result:

ok all 1 test passed

Test #45:

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

input:

10
5 2
2 2 2 1 2
5 2
2 1 2 1 2
5 2
1 2 2 2 1
5 2
2 1 2 1 1
5 2
1 1 1 2 1
5 2
1 2 2 1 2
5 2
2 1 1 2 2
5 2
2 2 2 1 1
5 2
1 1 2 1 2
5 2
1 2 2 2 1

output:

4
3 4
4 5
2 4
1 4
5
1 2
2 3
3 4
4 5
1 4
4
1 2
4 5
3 5
2 5
5
1 2
2 3
3 4
3 5
1 5
4
3 4
4 5
2 4
1 4
5
1 2
3 4
4 5
2 4
1 5
4
1 2
3 4
2 4
2 5
4
3 4
3 5
2 5
1 5
5
2 3
3 4
4 5
1 3
1 5
4
1 2
4 5
3 5
2 5

result:

ok all 10 test passed

Test #46:

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

input:

10
7 2
1 2 1 1 1 2 1
7 2
1 1 2 1 2 1 2
7 2
2 2 1 1 2 1 1
7 2
1 1 1 2 2 1 1
7 2
1 2 2 1 2 2 1
7 2
2 1 2 2 2 2 1
7 2
1 2 1 2 2 2 2
7 2
2 2 1 2 1 2 1
7 2
2 1 1 2 1 2 2
7 2
2 2 1 2 1 1 2

output:

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

result:

ok all 10 test passed

Test #47:

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

input:

10
9 2
1 1 1 2 1 2 2 1 2
9 2
1 2 1 1 2 2 2 2 1
9 2
2 1 2 1 1 2 1 2 1
9 2
1 1 2 1 1 1 1 2 2
9 2
1 1 2 2 1 2 1 2 2
9 2
2 2 1 2 1 2 2 2 2
9 2
1 1 2 2 2 1 2 1 2
9 2
1 1 2 1 1 2 2 2 2
9 2
1 1 1 1 2 1 1 2 1
9 2
2 1 2 2 1 1 2 2 1

output:

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

result:

ok all 10 test passed

Test #48:

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

input:

1
5 2
1 1 2 2 1

output:

4
2 3
4 5
3 5
1 3

result:

ok all 1 test passed

Test #49:

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

input:

1
7 2
2 1 1 2 1 1 2

output:

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

result:

ok all 1 test passed

Test #50:

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

input:

1
9 2
2 1 1 2 1 1 1 2 2

output:

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

result:

ok all 1 test passed

Test #51:

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

input:

4
20 2
2 1 1 2 1 2 1 1 2 1 1 1 1 2 2 2 1 1 2 2
20 2
2 1 2 2 2 1 1 2 2 2 1 2 2 2 2 1 2 2 1 2
20 2
2 2 1 1 2 2 1 1 1 1 1 2 1 1 2 2 1 2 1 1
20 2
2 1 2 2 2 1 2 2 1 1 1 2 1 2 2 1 2 1 1 2

output:

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

result:

ok all 4 test passed

Test #52:

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

input:

4
100 2
2 2 2 1 2 1 1 1 1 2 2 1 2 2 2 1 2 2 2 2 1 1 1 2 2 1 1 2 1 1 2 1 2 2 1 1 1 2 1 2 1 1 2 1 2 1 2 1 2 1 1 1 1 2 1 1 1 2 2 2 1 2 2 2 1 1 1 2 1 2 1 2 2 1 2 2 1 1 2 1 1 1 1 2 2 1 2 1 1 2 2 1 2 2 1 2 1 2 2 2
100 2
2 1 1 1 1 1 2 2 2 1 2 1 2 2 1 2 2 1 1 1 1 2 1 1 1 2 2 1 1 2 1 1 2 1 1 2 1 1 1 1 1 2 1 ...

output:

126
3 4
4 5
5 6
9 10
11 12
12 13
15 16
16 17
20 21
23 24
25 26
27 28
28 29
30 31
31 32
32 33
34 35
37 38
38 39
39 40
40 41
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
53 54
54 55
57 58
60 61
61 62
64 65
67 68
68 69
69 70
70 71
71 72
73 74
74 75
76 77
78 79
79 80
83 84
85 86
86 87
87 88
89 90
91 ...

result:

ok all 4 test passed

Test #53:

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

input:

1
300 2
2 2 1 1 1 2 2 2 2 2 2 2 2 1 2 2 2 2 1 1 1 1 1 2 1 1 1 1 2 1 2 1 1 1 1 1 2 2 2 1 2 2 2 2 1 2 2 2 1 2 2 2 1 1 1 1 1 1 1 2 2 2 1 2 2 1 2 2 1 2 2 1 2 1 2 2 2 1 2 2 2 2 2 1 1 2 1 1 2 2 1 2 2 2 1 1 2 1 1 2 2 2 2 1 2 2 2 2 2 2 1 2 1 2 2 1 2 1 2 1 1 1 1 2 1 2 1 1 1 1 2 2 2 2 1 2 2 1 2 1 2 1 1 2 2 1 ...

output:

367
2 3
5 6
13 14
14 15
18 19
23 24
24 25
28 29
29 30
30 31
31 32
36 37
39 40
40 41
44 45
45 46
48 49
49 50
52 53
59 60
62 63
63 64
65 66
66 67
68 69
69 70
71 72
72 73
73 74
74 75
77 78
78 79
83 84
85 86
86 87
88 89
90 91
91 92
94 95
96 97
97 98
99 100
103 104
104 105
110 111
111 112
112 113
113 114...

result:

ok all 1 test passed

Test #54:

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

input:

1
300 2
1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 ...

output:

373
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 101
10...

result:

ok all 1 test passed

Test #55:

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

input:

1
300 2
2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 ...

output:

313
4 5
14 15
24 25
34 35
44 45
54 55
64 65
74 75
84 85
94 95
104 105
114 115
124 125
134 135
144 145
154 155
164 165
174 175
184 185
194 195
204 205
214 215
224 225
234 235
244 245
254 255
264 265
274 275
284 285
294 295
294 296
294 297
294 298
294 299
294 300
293 300
292 300
291 300
290 300
289 30...

result:

ok all 1 test passed

Test #56:

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

input:

4
7 3
2 2 3 1 3 1 1
7 3
3 1 2 2 3 1 3
7 3
2 1 3 3 2 3 2
7 3
3 2 3 1 3 1 3

output:

9
2 3
3 4
4 5
5 6
2 4
1 4
5 7
1 5
1 7
9
1 2
2 3
4 5
5 6
6 7
3 5
1 3
3 6
3 7
9
1 2
2 3
4 5
5 6
6 7
2 4
2 5
2 6
2 7
10
1 2
2 3
3 4
4 5
5 6
6 7
2 4
2 5
2 6
2 7

result:

ok all 4 test passed

Test #57:

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

input:

4
20 3
1 2 3 1 3 2 1 1 2 3 1 2 2 1 1 2 2 1 2 2
20 3
1 2 1 2 3 3 2 1 1 3 3 2 2 1 2 3 1 1 2 2
20 3
3 1 1 3 3 1 3 2 1 1 2 3 3 3 1 1 2 1 1 1
20 3
3 2 2 1 3 1 1 3 3 2 2 2 1 1 2 1 2 2 2 2

output:

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

result:

ok all 4 test passed

Test #58:

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

input:

4
100 3
1 3 3 2 1 1 1 1 3 1 1 2 2 3 2 3 3 1 1 1 1 1 3 2 2 3 2 1 3 3 3 1 1 2 3 1 2 1 2 3 2 1 2 2 2 3 2 3 3 2 3 1 1 2 3 1 3 1 3 3 2 1 1 3 3 1 2 2 2 2 3 1 2 3 3 3 3 2 3 1 3 1 2 1 1 3 2 1 2 1 1 1 1 1 1 3 2 1 3 1
100 3
2 1 3 3 1 3 3 3 1 2 1 1 2 3 1 1 1 2 3 2 3 3 3 2 2 1 2 2 2 1 1 1 1 2 3 3 2 3 1 3 1 3 3 ...

output:

162
1 2
3 4
4 5
8 9
9 10
11 12
13 14
14 15
15 16
17 18
22 23
23 24
25 26
26 27
27 28
28 29
31 32
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
45 46
46 47
47 48
49 50
50 51
51 52
53 54
54 55
55 56
56 57
57 58
58 59
60 61
61 62
63 64
65 66
66 67
70 71
71 72
72 73
73 74
77 78
78 79
79 80...

result:

ok all 4 test passed

Test #59:

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

input:

1
300 3
2 1 2 1 2 2 1 2 3 1 1 2 3 3 3 2 3 1 1 2 1 1 1 3 3 3 2 1 1 2 2 1 1 3 2 3 1 3 2 2 2 3 1 3 2 1 3 1 1 3 1 2 1 2 1 3 2 1 3 3 1 2 1 2 2 1 1 3 2 1 2 3 1 2 2 2 1 3 3 1 2 3 1 3 1 1 3 1 3 1 2 1 1 3 1 3 3 2 2 2 1 2 1 2 2 3 2 1 3 3 1 2 1 3 2 3 1 2 1 1 2 2 1 1 2 3 1 1 3 2 3 3 1 1 1 3 2 1 1 2 1 3 3 2 3 1 ...

output:

505
1 2
2 3
3 4
4 5
6 7
7 8
8 9
9 10
11 12
12 13
15 16
16 17
17 18
19 20
20 21
23 24
26 27
27 28
29 30
31 32
33 34
34 35
35 36
36 37
37 38
38 39
41 42
42 43
43 44
44 45
45 46
46 47
47 48
49 50
50 51
51 52
52 53
53 54
54 55
55 56
56 57
57 58
58 59
60 61
61 62
62 63
63 64
65 66
67 68
68 69
69 70
70 71...

result:

ok all 1 test passed

Test #60:

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

input:

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

output:

11
1 2
2 3
3 4
4 5
5 6
6 7
4 6
3 6
2 6
1 6
1 7
11
1 2
2 3
3 4
4 5
5 6
6 7
4 6
3 6
2 6
1 6
1 7
11
1 2
2 3
3 4
4 5
5 6
6 7
4 6
3 6
2 6
1 6
1 7
11
1 2
2 3
3 4
4 5
5 6
6 7
4 6
3 6
2 6
1 6
1 7

result:

ok all 4 test passed

Test #61:

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

input:

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

output:

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

result:

ok all 4 test passed

Test #62:

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

input:

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

output:

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

result:

ok all 4 test passed

Test #63:

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

input:

1
300 300
77 46 15 213 13 258 21 73 122 114 55 238 294 179 97 175 25 104 83 153 80 36 135 216 252 100 50 169 5 211 253 146 223 82 76 44 90 288 261 174 14 222 127 298 203 151 286 178 68 28 85 75 42 167 112 226 106 123 220 230 242 160 132 2 161 232 229 291 22 170 158 57 193 263 266 71 184 289 195 136 ...

output:

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

result:

ok all 1 test passed

Test #64:

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

input:

4
20 4
2 2 4 3 1 2 1 3 2 2 1 3 3 4 4 3 2 2 2 3
20 4
3 3 3 1 1 3 2 2 2 2 1 4 4 2 1 4 3 4 4 3
20 4
1 1 3 4 3 3 1 3 1 4 2 1 1 2 2 4 3 4 4 2
20 4
3 4 3 3 1 4 4 2 2 2 4 1 1 3 4 3 4 2 2 3

output:

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

result:

ok all 4 test passed

Test #65:

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

input:

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

output:

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

result:

ok all 4 test passed

Test #66:

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

input:

1
300 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

299
35 36
185 186
185 187
185 188
185 189
185 190
185 191
185 192
185 193
185 194
185 195
185 196
185 197
185 198
185 199
185 200
185 201
185 202
185 203
185 204
185 205
185 206
185 207
185 208
185 209
185 210
185 211
185 212
185 213
185 214
185 215
185 216
185 217
185 218
185 219
185 220
185 221
18...

result:

ok all 1 test passed

Test #67:

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

input:

1
300 3
2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 ...

output:

447
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 101
10...

result:

ok all 1 test passed

Test #68:

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

input:

1
300 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

304
59 60
60 61
91 92
191 192
209 210
210 211
291 292
291 293
291 294
291 295
291 296
291 297
291 298
291 299
291 300
290 300
289 300
288 300
287 300
286 300
285 300
284 300
283 300
282 300
281 300
280 300
279 300
278 300
277 300
276 300
275 300
274 300
273 300
272 300
271 300
270 300
269 300
268 30...

result:

ok all 1 test passed

Test #69:

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

input:

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

output:

315
4 5
5 6
7 8
37 38
67 68
73 74
74 75
97 98
127 128
157 158
185 186
186 187
187 188
217 218
239 240
240 241
247 248
277 278
277 279
277 280
277 281
277 282
277 283
277 284
277 285
277 286
277 287
277 288
277 289
277 290
277 291
277 292
277 293
277 294
277 295
277 296
277 297
277 298
277 299
277 30...

result:

ok all 1 test passed

Test #70:

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

input:

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

output:

449
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
29 30
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
93 94
94 95
96 97
98 9...

result:

ok all 1 test passed

Test #71:

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

input:

1
1000 2
2 1 1 2 2 1 1 1 1 2 2 2 2 1 1 1 1 2 1 1 2 2 1 1 1 2 1 1 1 2 1 2 2 2 1 1 1 2 2 1 2 1 2 1 2 2 2 1 1 2 1 2 1 2 1 1 2 1 2 1 2 2 1 2 2 2 2 2 1 2 2 1 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 1 2 1 2 1 1 2 1 1 2 2 2 1 1 1 2 1 1 2 1 1 2 2 2 2 2 2 1 1 1 2 2 1 2 2 1 1 2 2 1 1 1 2 2 1 2 2 2 2 1 2 1...

output:

1251
1 2
3 4
5 6
9 10
13 14
17 18
18 19
20 21
22 23
25 26
26 27
29 30
30 31
31 32
34 35
37 38
39 40
40 41
41 42
42 43
43 44
44 45
47 48
49 50
50 51
51 52
52 53
53 54
54 55
56 57
57 58
58 59
59 60
60 61
62 63
63 64
68 69
69 70
71 72
72 73
75 76
76 77
83 84
84 85
90 91
91 92
94 95
95 96
96 97
97 98
98...

result:

ok all 1 test passed

Test #72:

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

input:

1
3000 2
1 2 2 2 2 1 1 1 1 1 1 2 1 1 2 1 2 2 1 1 2 2 2 2 1 1 1 1 2 2 1 2 1 1 1 2 2 2 2 2 1 2 1 1 1 2 1 1 2 1 2 1 2 1 1 2 1 1 1 2 2 1 1 2 1 1 2 2 2 2 1 1 2 2 2 1 1 2 2 2 2 2 2 2 1 1 2 1 2 2 1 2 2 1 1 2 1 2 1 1 2 1 2 1 2 2 2 1 2 1 1 1 1 1 1 1 2 1 2 1 2 1 1 2 2 1 2 1 1 2 2 2 2 1 2 2 2 1 2 1 1 2 1 2 2 2...

output:

3766
1 2
5 6
11 12
12 13
14 15
15 16
16 17
18 19
20 21
24 25
28 29
30 31
31 32
32 33
35 36
40 41
41 42
42 43
45 46
46 47
48 49
49 50
50 51
51 52
52 53
53 54
55 56
56 57
59 60
61 62
63 64
64 65
66 67
70 71
72 73
75 76
77 78
84 85
86 87
87 88
88 89
90 91
91 92
93 94
95 96
96 97
97 98
98 99
100 101
101...

result:

ok all 1 test passed

Test #73:

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

input:

1
2000 2
2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2...

output:

2498
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 101
1...

result:

ok all 1 test passed

Test #74:

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

input:

1
1000 2
2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 2 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2...

output:

1050
10 11
20 21
30 31
40 41
50 51
52 53
53 54
60 61
70 71
80 81
90 91
100 101
110 111
120 121
130 131
140 141
150 151
160 161
170 171
180 181
190 191
200 201
210 211
220 221
230 231
240 241
250 251
260 261
270 271
280 281
290 291
300 301
310 311
320 321
330 331
340 341
350 351
360 361
370 371
380 3...

result:

ok all 1 test passed

Test #75:

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

input:

1
1000 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

999
96 97
596 597
596 598
596 599
596 600
596 601
596 602
596 603
596 604
596 605
596 606
596 607
596 608
596 609
596 610
596 611
596 612
596 613
596 614
596 615
596 616
596 617
596 618
596 619
596 620
596 621
596 622
596 623
596 624
596 625
596 626
596 627
596 628
596 629
596 630
596 631
596 632
59...

result:

ok all 1 test passed

Test #76:

score: 0
Accepted
time: 6ms
memory: 6144kb

input:

1
22000 2
1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 ...

output:

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

result:

ok all 1 test passed

Test #77:

score: 0
Accepted
time: 4ms
memory: 6004kb

input:

1
12000 2
2 1 1 2 2 1 2 1 1 2 1 1 1 2 1 2 1 1 2 2 1 1 2 2 2 2 1 2 1 2 1 1 1 1 2 2 2 2 2 1 1 2 1 1 1 1 1 1 1 1 1 2 2 1 2 2 1 2 1 2 1 1 1 1 1 2 1 2 1 1 2 1 1 2 1 2 2 1 1 2 1 1 2 2 2 2 1 1 1 2 1 1 2 1 2 2 1 1 2 2 1 1 2 2 1 2 2 2 2 1 2 2 2 2 2 2 1 1 1 2 2 2 2 2 1 1 2 1 2 1 2 1 1 1 2 1 2 1 1 2 1 2 2 2 2 ...

output:

14969
1 2
3 4
5 6
6 7
7 8
9 10
10 11
13 14
14 15
15 16
16 17
18 19
20 21
22 23
26 27
27 28
28 29
29 30
30 31
34 35
39 40
41 42
42 43
51 52
53 54
54 55
56 57
57 58
58 59
59 60
60 61
65 66
66 67
67 68
68 69
70 71
71 72
73 74
74 75
75 76
77 78
79 80
80 81
82 83
86 87
89 90
90 91
92 93
93 94
94 95
96 97...

result:

ok all 1 test passed

Test #78:

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

input:

1
300 150
21 91 61 3 124 47 39 37 35 86 28 74 50 79 125 146 38 32 60 111 114 29 103 121 126 55 61 47 149 9 149 124 92 29 78 104 54 34 54 27 1 59 44 123 9 36 29 25 124 88 125 145 113 137 119 108 27 132 124 114 143 143 77 97 84 83 40 132 77 62 72 37 51 139 56 80 34 87 69 131 100 57 120 148 42 42 123 2...

output:

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

result:

ok all 1 test passed

Test #79:

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

input:

1
1000 3
3 2 3 3 2 1 2 1 2 1 2 3 1 1 2 3 1 3 3 2 1 3 1 1 3 3 1 2 1 2 1 1 3 2 2 1 2 3 2 2 3 1 2 2 1 1 2 2 1 2 1 1 3 1 1 3 3 2 1 2 3 2 1 3 3 2 2 2 3 2 3 3 1 2 1 1 2 1 2 3 1 2 1 3 1 3 3 1 2 1 1 2 2 1 1 2 2 2 1 1 3 1 1 1 3 2 2 1 1 3 2 3 1 2 3 3 3 2 3 3 1 2 3 3 2 2 2 2 2 1 2 3 3 3 2 2 3 3 1 1 2 3 1 1 1 2...

output:

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

result:

ok all 1 test passed

Test #80:

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

input:

1
1000 30
18 16 27 2 30 22 9 1 20 18 30 3 14 23 2 12 10 6 30 3 14 24 10 18 20 18 24 3 28 27 8 25 22 23 13 28 3 8 4 22 30 23 21 4 7 27 23 16 24 23 15 9 18 23 1 12 25 23 18 14 21 25 25 4 30 23 17 28 17 23 13 2 14 3 29 27 12 15 29 11 9 23 8 17 17 27 14 11 15 25 11 19 13 16 3 2 22 2 2 29 6 14 12 20 13 2...

output:

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

result:

ok all 1 test passed

Test #81:

score: 0
Accepted
time: 11ms
memory: 6240kb

input:

1
30000 3
3 3 1 1 3 2 2 2 3 2 2 2 3 3 3 2 3 1 2 2 1 1 3 1 1 3 3 1 2 2 3 1 1 3 3 3 3 1 2 2 2 3 3 2 1 3 1 2 1 1 2 2 2 2 1 3 1 2 1 1 2 2 3 2 1 2 2 2 1 2 3 2 2 2 1 3 1 3 3 3 2 2 3 1 3 2 3 2 2 3 3 2 2 1 2 3 1 1 2 1 3 2 3 2 3 3 3 2 3 2 1 3 2 3 1 3 3 3 2 3 2 1 2 1 3 2 2 1 1 1 1 2 1 3 2 2 1 1 2 1 3 1 1 2 1 ...

output:

50050
2 3
4 5
5 6
8 9
9 10
12 13
15 16
16 17
17 18
18 19
20 21
22 23
23 24
25 26
27 28
28 29
30 31
31 32
33 34
37 38
38 39
41 42
43 44
44 45
45 46
46 47
47 48
48 49
50 51
54 55
55 56
56 57
57 58
58 59
60 61
62 63
63 64
64 65
65 66
68 69
69 70
70 71
71 72
74 75
75 76
76 77
77 78
80 81
82 83
83 84
84 ...

result:

ok all 1 test passed

Test #82:

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

input:

1
15000 3
1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 ...

output:

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

result:

ok all 1 test passed

Test #83:

score: 0
Accepted
time: 4ms
memory: 5924kb

input:

1
13998 3
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

13998
1263 1264
5929 5930
10595 10596
10595 10597
10595 10598
10595 10599
10595 10600
10595 10601
10595 10602
10595 10603
10595 10604
10595 10605
10595 10606
10595 10607
10595 10608
10595 10609
10595 10610
10595 10611
10595 10612
10595 10613
10595 10614
10595 10615
10595 10616
10595 10617
10595 1061...

result:

ok all 1 test passed

Test #84:

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

input:

1
10000 5000
1401 1401 1402 1402 1403 1403 1404 1404 1405 1405 1406 1406 1407 1407 1408 1408 1409 1409 1410 1410 1411 1411 1412 1412 1413 1413 1414 1414 1415 1415 1416 1416 1417 1417 1418 1418 1419 1419 1420 1420 1421 1421 1422 1422 1423 1423 1424 1424 1425 1425 1426 1426 1427 1427 1428 1428 1429 14...

output:

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

result:

ok all 1 test passed

Test #85:

score: 0
Accepted
time: 34ms
memory: 6464kb

input:

101
4 2
1 1 2 2
4 2
1 2 1 2
3 3
1 2 3
2 2
1 2
5 2
2 2 2 1 2
5 2
2 1 2 1 2
5 2
1 2 2 2 1
5 2
2 1 2 1 1
5 2
1 1 1 2 1
5 2
1 2 2 1 2
5 2
2 1 1 2 2
5 2
2 2 2 1 1
5 2
1 1 2 1 2
5 2
1 2 2 2 1
7 2
1 2 1 1 1 2 1
7 2
1 1 2 1 2 1 2
7 2
2 2 1 1 2 1 1
7 2
1 1 1 2 2 1 1
7 2
1 2 2 1 2 2 1
7 2
2 1 2 2 2 2 1
7 2
1 ...

output:

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

result:

ok all 101 test passed

Test #86:

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

input:

87
4 2
1 1 2 2
4 2
1 2 1 2
3 3
1 2 3
2 2
1 2
5 2
2 2 2 1 2
5 2
2 1 2 1 2
5 2
1 2 2 2 1
5 2
2 1 2 1 1
5 2
1 1 1 2 1
5 2
1 2 2 1 2
5 2
2 1 1 2 2
5 2
2 2 2 1 1
5 2
1 1 2 1 2
5 2
1 2 2 2 1
7 2
1 2 1 1 1 2 1
7 2
1 1 2 1 2 1 2
7 2
2 2 1 1 2 1 1
7 2
1 1 1 2 2 1 1
7 2
1 2 2 1 2 2 1
7 2
2 1 2 2 2 2 1
7 2
1 2...

output:

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

result:

ok all 87 test passed

Test #87:

score: 0
Accepted
time: 34ms
memory: 6224kb

input:

101
4 2
1 1 2 2
4 2
1 2 1 2
3 3
1 2 3
2 2
1 2
5 2
2 2 2 1 2
5 2
2 1 2 1 2
5 2
1 2 2 2 1
5 2
2 1 2 1 1
5 2
1 1 1 2 1
5 2
1 2 2 1 2
5 2
2 1 1 2 2
5 2
2 2 2 1 1
5 2
1 1 2 1 2
5 2
1 2 2 2 1
7 2
1 2 1 1 1 2 1
7 2
1 1 2 1 2 1 2
7 2
2 2 1 1 2 1 1
7 2
1 1 1 2 2 1 1
7 2
1 2 2 1 2 2 1
7 2
2 1 2 2 2 2 1
7 2
1 ...

output:

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

result:

ok all 101 test passed

Test #88:

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

input:

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

output:

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

result:

ok all 3 test passed

Test #89:

score: 0
Accepted
time: 20ms
memory: 7376kb

input:

1
100000 2
2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1...

output:

104998
3 4
13 14
23 24
33 34
43 44
53 54
63 64
73 74
83 84
93 94
103 104
113 114
123 124
133 134
143 144
153 154
163 164
173 174
183 184
193 194
203 204
213 214
223 224
233 234
243 244
253 254
263 264
273 274
283 284
293 294
303 304
313 314
323 324
333 334
343 344
353 354
363 364
373 374
383 384
393...

result:

ok all 1 test passed

Test #90:

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

input:

1
2 2
1 2

output:

1
1 2

result:

ok all 1 test passed

Test #91:

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

input:

10
5 2
2 2 2 1 2
5 2
2 1 2 1 2
5 2
1 2 2 2 1
5 2
2 1 2 1 1
5 2
1 1 1 2 1
5 2
1 2 2 1 2
5 2
2 1 1 2 2
5 2
2 2 2 1 1
5 2
1 1 2 1 2
5 2
1 2 2 2 1

output:

4
3 4
4 5
2 4
1 4
5
1 2
2 3
3 4
4 5
1 4
4
1 2
4 5
3 5
2 5
5
1 2
2 3
3 4
3 5
1 5
4
3 4
4 5
2 4
1 4
5
1 2
3 4
4 5
2 4
1 5
4
1 2
3 4
2 4
2 5
4
3 4
3 5
2 5
1 5
5
2 3
3 4
4 5
1 3
1 5
4
1 2
4 5
3 5
2 5

result:

ok all 10 test passed

Test #92:

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

input:

10
7 2
1 2 1 1 1 2 1
7 2
1 1 2 1 2 1 2
7 2
2 2 1 1 2 1 1
7 2
1 1 1 2 2 1 1
7 2
1 2 2 1 2 2 1
7 2
2 1 2 2 2 2 1
7 2
1 2 1 2 2 2 2
7 2
2 2 1 2 1 2 1
7 2
2 1 1 2 1 2 2
7 2
2 2 1 2 1 1 2

output:

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

result:

ok all 10 test passed

Test #93:

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

input:

10
9 2
1 1 1 2 1 2 2 1 2
9 2
1 2 1 1 2 2 2 2 1
9 2
2 1 2 1 1 2 1 2 1
9 2
1 1 2 1 1 1 1 2 2
9 2
1 1 2 2 1 2 1 2 2
9 2
2 2 1 2 1 2 2 2 2
9 2
1 1 2 2 2 1 2 1 2
9 2
1 1 2 1 1 2 2 2 2
9 2
1 1 1 1 2 1 1 2 1
9 2
2 1 2 2 1 1 2 2 1

output:

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

result:

ok all 10 test passed

Test #94:

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

input:

1
5 2
1 1 2 2 1

output:

4
2 3
4 5
3 5
1 3

result:

ok all 1 test passed

Test #95:

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

input:

1
7 2
2 1 1 2 1 1 2

output:

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

result:

ok all 1 test passed

Test #96:

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

input:

1
9 2
2 1 1 2 1 1 1 2 2

output:

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

result:

ok all 1 test passed

Test #97:

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

input:

10
20 2
2 1 1 1 2 2 1 1 2 1 2 1 2 1 1 2 1 2 2 2
20 2
2 1 1 1 2 1 1 1 1 2 1 2 2 1 2 1 1 1 1 2
20 2
2 1 1 2 1 2 1 1 2 1 2 2 2 1 1 2 1 2 2 2
20 2
2 2 1 2 2 2 2 1 1 2 2 2 1 2 1 1 1 2 1 2
20 2
1 1 2 2 2 1 2 1 1 2 1 2 2 2 1 1 2 1 1 1
20 2
2 1 2 1 1 2 1 2 2 1 1 2 2 1 2 2 1 2 2 1
20 2
1 1 1 2 1 2 2 1 2 1 2 ...

output:

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

result:

ok all 10 test passed

Test #98:

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

input:

10
100 2
2 1 1 2 2 1 1 2 2 1 2 1 1 2 1 1 2 1 2 2 2 1 2 2 1 1 2 1 1 2 2 2 2 2 1 1 1 1 2 2 1 2 1 2 1 2 1 1 2 2 1 1 2 1 2 2 1 1 2 2 2 2 2 2 2 1 1 2 1 2 1 1 1 1 1 2 1 1 1 2 1 2 2 1 2 2 1 2 1 2 1 1 1 1 2 2 2 2 1 1
100 2
1 1 2 1 1 1 1 1 2 2 1 2 2 1 1 1 1 2 2 1 1 2 2 2 2 2 2 2 2 2 1 2 1 2 1 2 2 1 2 2 2 1 2...

output:

125
1 2
3 4
5 6
7 8
9 10
10 11
11 12
13 14
14 15
16 17
17 18
18 19
21 22
22 23
24 25
26 27
27 28
29 30
34 35
38 39
40 41
41 42
42 43
43 44
44 45
45 46
46 47
48 49
50 51
52 53
53 54
54 55
56 57
58 59
65 66
67 68
68 69
69 70
70 71
75 76
76 77
79 80
80 81
81 82
83 84
84 85
86 87
87 88
88 89
89 90
90 91...

result:

ok all 10 test passed

Test #99:

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

input:

1
300 2
2 2 1 1 1 2 2 2 2 2 2 2 2 1 2 2 2 2 1 1 1 1 1 2 1 1 1 1 2 1 2 1 1 1 1 1 2 2 2 1 2 2 2 2 1 2 2 2 1 2 2 2 1 1 1 1 1 1 1 2 2 2 1 2 2 1 2 2 1 2 2 1 2 1 2 2 2 1 2 2 2 2 2 1 1 2 1 1 2 2 1 2 2 2 1 1 2 1 1 2 2 2 2 1 2 2 2 2 2 2 1 2 1 2 2 1 2 1 2 1 1 1 1 2 1 2 1 1 1 1 2 2 2 2 1 2 2 1 2 1 2 1 1 2 2 1 ...

output:

367
2 3
5 6
13 14
14 15
18 19
23 24
24 25
28 29
29 30
30 31
31 32
36 37
39 40
40 41
44 45
45 46
48 49
49 50
52 53
59 60
62 63
63 64
65 66
66 67
68 69
69 70
71 72
72 73
73 74
74 75
77 78
78 79
83 84
85 86
86 87
88 89
90 91
91 92
94 95
96 97
97 98
99 100
103 104
104 105
110 111
111 112
112 113
113 114...

result:

ok all 1 test passed

Test #100:

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

input:

10
7 3
2 3 1 2 2 3 3
7 3
1 2 3 1 3 3 2
7 3
1 3 1 2 1 2 1
7 3
3 1 2 3 1 2 2
7 3
1 2 3 2 1 1 2
7 3
3 2 2 3 3 1 1
7 3
3 1 2 2 1 3 3
7 3
3 3 3 2 2 1 1
7 3
2 1 3 1 3 1 2
7 3
3 2 3 1 1 1 1

output:

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

result:

ok all 10 test passed

Test #101:

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

input:

10
20 3
2 1 2 1 3 2 2 1 3 3 3 1 3 3 2 3 3 3 1 2
20 3
3 2 2 1 2 1 3 1 3 1 3 2 2 2 1 2 2 1 1 3
20 3
3 3 2 2 2 2 3 1 2 1 3 1 1 1 2 1 1 3 3 2
20 3
1 1 1 3 2 3 2 3 3 1 3 2 2 2 2 3 3 2 1 1
20 3
2 3 1 2 3 3 3 1 2 3 1 3 2 3 2 2 3 3 1 1
20 3
2 3 2 2 1 3 1 2 1 3 3 1 3 1 3 1 1 3 1 2
20 3
3 1 2 1 3 3 3 1 3 3 1 ...

output:

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

result:

ok all 10 test passed

Test #102:

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

input:

10
100 3
3 1 3 3 2 3 1 3 3 3 1 2 1 1 1 2 2 2 1 1 1 2 3 1 2 1 3 2 1 2 2 2 2 1 3 1 3 3 1 3 2 2 1 1 3 3 1 1 3 2 1 1 1 2 1 1 3 2 2 3 2 3 1 3 3 3 3 1 2 3 1 2 1 3 1 2 3 2 1 3 3 1 1 3 2 1 2 3 2 2 3 3 1 1 3 3 2 1 2 2
100 3
1 2 3 2 3 2 1 3 2 1 2 2 1 3 2 1 3 2 2 1 1 3 1 3 3 2 3 2 2 2 3 2 1 1 1 3 3 3 1 1 2 1 3...

output:

166
1 2
2 3
4 5
5 6
6 7
7 8
10 11
11 12
12 13
15 16
18 19
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
33 34
34 35
35 36
36 37
38 39
39 40
40 41
42 43
44 45
46 47
48 49
49 50
50 51
53 54
54 55
56 57
57 58
59 60
60 61
61 62
62 63
63 64
67 68
68 69
69 70
70 71
71 72
72 73
73 74
74 75
75 76
76...

result:

ok all 10 test passed

Test #103:

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

input:

1
300 3
2 1 2 1 2 2 1 2 3 1 1 2 3 3 3 2 3 1 1 2 1 1 1 3 3 3 2 1 1 2 2 1 1 3 2 3 1 3 2 2 2 3 1 3 2 1 3 1 1 3 1 2 1 2 1 3 2 1 3 3 1 2 1 2 2 1 1 3 2 1 2 3 1 2 2 2 1 3 3 1 2 3 1 3 1 1 3 1 3 1 2 1 1 3 1 3 3 2 2 2 1 2 1 2 2 3 2 1 3 3 1 2 1 3 2 3 1 2 1 1 2 2 1 1 2 3 1 1 3 2 3 3 1 1 1 3 2 1 1 2 1 3 3 2 3 1 ...

output:

505
1 2
2 3
3 4
4 5
6 7
7 8
8 9
9 10
11 12
12 13
15 16
16 17
17 18
19 20
20 21
23 24
26 27
27 28
29 30
31 32
33 34
34 35
35 36
36 37
37 38
38 39
41 42
42 43
43 44
44 45
45 46
46 47
47 48
49 50
50 51
51 52
52 53
53 54
54 55
55 56
56 57
57 58
58 59
60 61
61 62
62 63
63 64
65 66
67 68
68 69
69 70
70 71...

result:

ok all 1 test passed

Test #104:

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

input:

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

output:

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

result:

ok all 10 test passed

Test #105:

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

input:

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

output:

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

result:

ok all 10 test passed

Test #106:

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

input:

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

output:

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

result:

ok all 10 test passed

Test #107:

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

input:

1
300 300
77 46 15 213 13 258 21 73 122 114 55 238 294 179 97 175 25 104 83 153 80 36 135 216 252 100 50 169 5 211 253 146 223 82 76 44 90 288 261 174 14 222 127 298 203 151 286 178 68 28 85 75 42 167 112 226 106 123 220 230 242 160 132 2 161 232 229 291 22 170 158 57 193 263 266 71 184 289 195 136 ...

output:

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

result:

ok all 1 test passed

Test #108:

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

input:

10
20 4
4 1 1 3 1 4 2 3 2 2 1 3 2 2 3 2 3 2 2 1
20 4
4 1 3 2 4 4 4 3 2 4 1 4 3 4 2 2 3 4 1 4
20 4
4 2 2 1 3 1 2 4 1 2 1 2 1 3 1 3 4 4 1 3
20 4
1 1 1 3 4 1 4 2 3 1 4 4 2 4 2 1 2 3 4 1
20 4
1 2 3 1 1 1 3 1 1 2 1 4 2 4 3 3 3 1 3 2
20 4
1 1 4 2 1 3 1 1 3 1 3 4 2 1 2 4 2 3 1 4
20 4
2 3 2 2 1 1 2 2 2 2 4 ...

output:

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

result:

ok all 10 test passed

Test #109:

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

input:

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

output:

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

result:

ok all 10 test passed

Test #110:

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

input:

1
300 2
1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 ...

output:

373
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 101
10...

result:

ok all 1 test passed

Test #111:

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

input:

1
300 2
2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 1 ...

output:

313
4 5
14 15
24 25
34 35
44 45
54 55
64 65
74 75
84 85
94 95
104 105
114 115
124 125
134 135
144 145
154 155
164 165
174 175
184 185
194 195
204 205
214 215
224 225
234 235
244 245
254 255
264 265
274 275
284 285
294 295
294 296
294 297
294 298
294 299
294 300
293 300
292 300
291 300
290 300
289 30...

result:

ok all 1 test passed

Test #112:

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

input:

1
300 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

299
35 36
185 186
185 187
185 188
185 189
185 190
185 191
185 192
185 193
185 194
185 195
185 196
185 197
185 198
185 199
185 200
185 201
185 202
185 203
185 204
185 205
185 206
185 207
185 208
185 209
185 210
185 211
185 212
185 213
185 214
185 215
185 216
185 217
185 218
185 219
185 220
185 221
18...

result:

ok all 1 test passed

Test #113:

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

input:

1
300 3
2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 ...

output:

447
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 101
10...

result:

ok all 1 test passed

Test #114:

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

input:

1
300 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

304
59 60
60 61
91 92
191 192
209 210
210 211
291 292
291 293
291 294
291 295
291 296
291 297
291 298
291 299
291 300
290 300
289 300
288 300
287 300
286 300
285 300
284 300
283 300
282 300
281 300
280 300
279 300
278 300
277 300
276 300
275 300
274 300
273 300
272 300
271 300
270 300
269 300
268 30...

result:

ok all 1 test passed

Test #115:

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

input:

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

output:

315
4 5
5 6
7 8
37 38
67 68
73 74
74 75
97 98
127 128
157 158
185 186
186 187
187 188
217 218
239 240
240 241
247 248
277 278
277 279
277 280
277 281
277 282
277 283
277 284
277 285
277 286
277 287
277 288
277 289
277 290
277 291
277 292
277 293
277 294
277 295
277 296
277 297
277 298
277 299
277 30...

result:

ok all 1 test passed

Test #116:

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

input:

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

output:

449
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
29 30
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
93 94
94 95
96 97
98 9...

result:

ok all 1 test passed

Test #117:

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

input:

1
300 150
21 91 61 3 124 47 39 37 35 86 28 74 50 79 125 146 38 32 60 111 114 29 103 121 126 55 61 47 149 9 149 124 92 29 78 104 54 34 54 27 1 59 44 123 9 36 29 25 124 88 125 145 113 137 119 108 27 132 124 114 143 143 77 97 84 83 40 132 77 62 72 37 51 139 56 80 34 87 69 131 100 57 120 148 42 42 123 2...

output:

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

result:

ok all 1 test passed

Test #118:

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

input:

1
1000 3
3 2 3 3 2 1 2 1 2 1 2 3 1 1 2 3 1 3 3 2 1 3 1 1 3 3 1 2 1 2 1 1 3 2 2 1 2 3 2 2 3 1 2 2 1 1 2 2 1 2 1 1 3 1 1 3 3 2 1 2 3 2 1 3 3 2 2 2 3 2 3 3 1 2 1 1 2 1 2 3 1 2 1 3 1 3 3 1 2 1 1 2 2 1 1 2 2 2 1 1 3 1 1 1 3 2 2 1 1 3 2 3 1 2 3 3 3 2 3 3 1 2 3 3 2 2 2 2 2 1 2 3 3 3 2 2 3 3 1 1 2 3 1 1 1 2...

output:

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

result:

ok all 1 test passed

Test #119:

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

input:

1
50000 3
1 1 1 2 3 1 3 3 3 2 3 1 2 1 1 3 2 3 3 3 2 3 3 3 3 1 2 3 1 3 2 2 1 2 3 2 3 3 2 1 1 3 3 2 2 2 3 1 2 3 3 3 2 2 2 2 1 3 1 1 2 1 3 3 3 2 1 3 3 3 3 3 1 3 1 1 1 2 2 1 2 1 2 3 1 2 2 3 3 3 3 2 3 2 2 3 2 1 3 2 2 3 3 2 1 1 2 3 1 2 1 1 3 3 3 3 1 3 3 3 3 3 3 1 3 1 2 2 1 3 2 2 1 1 3 2 1 1 3 3 1 2 3 3 3 ...

output:

83344
3 4
4 5
5 6
6 7
9 10
10 11
11 12
12 13
13 14
15 16
16 17
17 18
20 21
21 22
25 26
26 27
27 28
28 29
29 30
30 31
32 33
33 34
34 35
35 36
36 37
38 39
39 40
41 42
43 44
46 47
47 48
48 49
49 50
52 53
56 57
57 58
58 59
60 61
61 62
62 63
65 66
66 67
67 68
72 73
73 74
74 75
77 78
79 80
80 81
81 82
82 ...

result:

ok all 1 test passed

Test #120:

score: 0
Accepted
time: 69ms
memory: 14104kb

input:

1
200000 3
2 2 3 2 2 2 3 2 3 2 3 2 1 2 3 3 3 2 2 2 1 1 1 3 1 1 2 2 2 3 1 2 3 2 1 2 3 1 2 2 2 2 1 3 1 2 3 1 1 3 3 1 1 3 1 1 3 1 3 2 2 1 3 1 3 1 1 3 1 3 1 2 1 1 3 2 1 1 3 2 2 2 1 3 2 1 3 2 1 2 3 2 2 1 2 2 2 1 1 1 2 2 3 1 2 2 2 3 1 2 3 1 2 1 3 2 2 2 1 1 1 3 2 2 3 1 3 2 1 3 2 3 1 3 3 3 3 1 1 1 3 1 1 3 3...

output:

333408
2 3
3 4
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
17 18
20 21
23 24
24 25
26 27
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
42 43
43 44
44 45
45 46
46 47
47 48
49 50
51 52
53 54
54 55
56 57
57 58
58 59
59 60
61 62
62 63
63 64
64 65
65 66
67 68
68 69
69 70
70 71
71 72
72 7...

result:

ok all 1 test passed

Test #121:

score: 0
Accepted
time: 94ms
memory: 21000kb

input:

1
200000 200000
71411 193310 53795 23615 45771 160252 44119 78297 131589 51364 26492 146125 67205 6162 46301 154524 63313 17662 99459 174369 2147 116145 193734 83070 149201 160201 50714 37506 63554 72954 57451 105091 66834 1649 190400 22397 45745 20241 100997 1097 105227 109475 49745 49889 23931 153...

output:

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

result:

ok all 1 test passed

Test #122:

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

input:

1
1000 2
2 1 1 2 2 1 1 1 1 2 2 2 2 1 1 1 1 2 1 1 2 2 1 1 1 2 1 1 1 2 1 2 2 2 1 1 1 2 2 1 2 1 2 1 2 2 2 1 1 2 1 2 1 2 1 1 2 1 2 1 2 2 1 2 2 2 2 2 1 2 2 1 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 1 2 1 2 1 1 2 1 1 2 2 2 1 1 1 2 1 1 2 1 1 2 2 2 2 2 2 1 1 1 2 2 1 2 2 1 1 2 2 1 1 1 2 2 1 2 2 2 2 1 2 1...

output:

1251
1 2
3 4
5 6
9 10
13 14
17 18
18 19
20 21
22 23
25 26
26 27
29 30
30 31
31 32
34 35
37 38
39 40
40 41
41 42
42 43
43 44
44 45
47 48
49 50
50 51
51 52
52 53
53 54
54 55
56 57
57 58
58 59
59 60
60 61
62 63
63 64
68 69
69 70
71 72
72 73
75 76
76 77
83 84
84 85
90 91
91 92
94 95
95 96
96 97
97 98
98...

result:

ok all 1 test passed

Test #123:

score: 0
Accepted
time: 9ms
memory: 6468kb

input:

1
50000 2
1 1 1 1 2 2 2 1 1 1 2 2 2 1 2 2 1 1 2 2 2 2 2 1 1 1 1 2 1 2 2 1 1 2 1 1 1 2 2 1 2 2 1 1 2 1 1 1 2 1 1 1 2 2 2 1 2 2 2 1 1 1 2 1 1 2 1 2 1 1 1 1 1 1 1 2 2 1 1 2 2 1 1 1 2 1 2 2 1 1 1 2 2 2 1 2 2 2 2 1 2 1 1 1 2 1 2 1 1 1 1 1 2 2 1 1 1 2 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 2 1 2 2 2 2 1 2 2 2 2 ...

output:

62493
4 5
7 8
10 11
13 14
14 15
16 17
18 19
23 24
27 28
28 29
29 30
31 32
33 34
34 35
37 38
39 40
40 41
42 43
44 45
45 46
48 49
49 50
52 53
55 56
56 57
59 60
62 63
63 64
65 66
66 67
67 68
68 69
75 76
77 78
79 80
81 82
84 85
85 86
86 87
88 89
91 92
94 95
95 96
99 100
100 101
101 102
104 105
105 106
1...

result:

ok all 1 test passed

Test #124:

score: 0
Accepted
time: 43ms
memory: 9204kb

input:

1
200000 2
2 2 2 2 1 1 2 2 1 2 2 1 2 1 1 2 1 1 2 1 1 1 2 2 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 2 1 1 2 1 1 2 2 2 1 2 2 2 2 2 1 2 2 1 1 2 1 1 1 2 1 2 1 2 1 1 2 1 1 1 1 1 1 2 2 2 2 1 1 1 1 2 2 2 1 1 1 1 2 1 2 1 1 2 2 1 2 1 1 2 1 2 1 1 2 2 2 2 2 2 1 1 2 2 1 2 2 1 2 1 1 1 2 1 1 2 1 1 2 2 1 2 1 2 2 2 1 1 2 1 1...

output:

249802
4 5
6 7
8 9
9 10
11 12
12 13
13 14
15 16
16 17
18 19
19 20
22 23
24 25
33 34
34 35
37 38
38 39
39 40
40 41
42 43
43 44
45 46
48 49
49 50
54 55
55 56
57 58
59 60
60 61
63 64
64 65
65 66
66 67
67 68
68 69
70 71
71 72
77 78
81 82
85 86
88 89
92 93
93 94
94 95
95 96
97 98
99 100
100 101
101 102
1...

result:

ok all 1 test passed

Test #125:

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

input:

1
1000 30
18 16 27 2 30 22 9 1 20 18 30 3 14 23 2 12 10 6 30 3 14 24 10 18 20 18 24 3 28 27 8 25 22 23 13 28 3 8 4 22 30 23 21 4 7 27 23 16 24 23 15 9 18 23 1 12 25 23 18 14 21 25 25 4 30 23 17 28 17 23 13 2 14 3 29 27 12 15 29 11 9 23 8 17 17 27 14 11 15 25 11 19 13 16 3 2 22 2 2 29 6 14 12 20 13 2...

output:

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

result:

ok all 1 test passed

Test #126:

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

input:

1
50000 200
92 72 198 135 4 150 28 113 136 17 48 43 90 30 110 25 115 86 44 35 138 189 3 76 10 53 29 11 62 175 62 165 82 10 95 72 89 76 17 43 186 140 87 199 131 196 171 4 137 65 11 31 152 154 28 181 39 31 71 62 175 169 125 37 37 96 100 60 173 93 9 162 186 100 104 172 90 134 75 14 199 109 101 167 191 ...

output:

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

result:

ok all 1 test passed

Test #127:

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

input:

1
200000 400
194 273 81 167 64 136 269 276 68 53 308 233 254 201 322 244 330 315 106 300 38 267 60 206 206 1 177 19 53 219 8 378 45 190 250 55 203 159 295 243 262 86 36 83 269 154 178 255 12 224 368 371 108 11 55 208 216 110 177 101 99 50 54 196 96 399 138 78 93 292 87 218 293 192 207 60 163 325 159...

output:

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

result:

ok all 1 test passed

Test #128:

score: 0
Accepted
time: 38ms
memory: 10352kb

input:

1
200000 2
2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2...

output:

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

result:

ok all 1 test passed

Test #129:

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

input:

1
100000 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

100050
308 309
1308 1309
2308 2309
3308 3309
4308 4309
5308 5309
6308 6309
7308 7309
8308 8309
9308 9309
10308 10309
11308 11309
12308 12309
13308 13309
14308 14309
15308 15309
16308 16309
17308 17309
18308 18309
19308 19309
20308 20309
21308 21309
22308 22309
23308 23309
24308 24309
25308 25309
263...

result:

ok all 1 test passed

Test #130:

score: 0
Accepted
time: 26ms
memory: 9068kb

input:

1
200000 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

200003
50100 50101
50101 50102
66072 66073
66073 66074
74862 74863
76162 76163
76163 76164
115984 115985
115985 115986
174862 174863
174862 174864
174862 174865
174862 174866
174862 174867
174862 174868
174862 174869
174862 174870
174862 174871
174862 174872
174862 174873
174862 174874
174862 174875...

result:

ok all 1 test passed

Test #131:

score: 0
Accepted
time: 53ms
memory: 9528kb

input:

1
150000 3
2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2...

output:

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

result:

ok all 1 test passed

Test #132:

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

input:

1
150000 3
3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2...

output:

164997
10 11
20 21
30 31
40 41
50 51
60 61
70 71
80 81
90 91
100 101
110 111
120 121
130 131
140 141
150 151
160 161
170 171
180 181
190 191
200 201
210 211
220 221
230 231
240 241
250 251
260 261
270 271
280 281
290 291
300 301
310 311
320 321
330 331
340 341
350 351
360 361
370 371
380 381
390 391...

result:

ok all 1 test passed

Test #133:

score: 0
Accepted
time: 40ms
memory: 11556kb

input:

1
199998 3
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

200002
11589 11590
78255 78256
79935 79936
79936 79937
144921 144922
171250 171251
171251 171252
171251 171253
171251 171254
171251 171255
171251 171256
171251 171257
171251 171258
171251 171259
171251 171260
171251 171261
171251 171262
171251 171263
171251 171264
171251 171265
171251 171266
171251 ...

result:

ok all 1 test passed

Test #134:

score: 0
Accepted
time: 54ms
memory: 11720kb

input:

1
200000 100
78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78...

output:

200097
778 779
2778 2779
4778 4779
6778 6779
8778 8779
10778 10779
12778 12779
14778 14779
16778 16779
18778 18779
20778 20779
22778 22779
24778 24779
26778 26779
28778 28779
30778 30779
32778 32779
34778 34779
36778 36779
38778 38779
40778 40779
42778 42779
44778 44779
46778 46779
48778 48779
50778...

result:

ok all 1 test passed

Test #135:

score: 0
Accepted
time: 82ms
memory: 19328kb

input:

1
200000 100000
96138 96138 96139 96139 96140 96140 96141 96141 96142 96142 96143 96143 96144 96144 96145 96145 96146 96146 96147 96147 96148 96148 96149 96149 96150 96150 96151 96151 96152 96152 96153 96153 96154 96154 96155 96155 96156 96156 96157 96157 96158 96158 96159 96159 96160 96160 96161 96...

output:

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

result:

ok all 1 test passed