QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#154213#6414. Classical Maximization ProblemPhantomThreshold#TL 556ms16336kbC++201.5kb2023-08-31 15:08:332023-08-31 15:08:33

Judging History

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

  • [2023-08-31 15:08:33]
  • 评测
  • 测评结果:TL
  • 用时:556ms
  • 内存:16336kb
  • [2023-08-31 15:08:33]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int T;
	cin>>T;
	while(T--)
	{
		int n;
		cin>>n;
		n*=2;
		vector<int> x(n+5),y(n+5);
		map<int,vector<int>> sx,sy;
		for(int i=1;i<=n;i++)
		{
			cin>>x[i]>>y[i];
			sx[x[i]].push_back(i);
			sy[y[i]].push_back(i);
		}
		vector<int> vis(n+5);
		vector<pair<int,int>> ans;
		function<int(int,int)> dfs=[&](int u,int ty)//0:x,1:y
		{
			vis[u]=1;
			int rx=0,ry=0;
			for(auto v:sx[x[u]])
			{
				if(not vis[v])
				{
					int r=dfs(v,0);
					if(r)
					{
						if(rx)ans.emplace_back(r,rx),rx=0;
						else rx=r;
					}
				}
			}
			for(auto v:sy[y[u]])
			{
				if(not vis[v])
				{
					int r=dfs(v,1);
					if(r)
					{
						if(ry)ans.emplace_back(r,ry),ry=0;
						else ry=r;
					}
				}
			}
			if(not rx and not ry)
			{
				return u;
			}
			else if(rx and ry)
			{
				if(ty)
				{
					ans.emplace_back(u,rx);
					return ry;
				}
				else
				{
					ans.emplace_back(u,ry);
					return rx;
				}
			}
			else
			{
				ans.emplace_back(u,rx|ry);
				return 0;
			}
		};
		vector<int> rem;
		for(int i=1;i<=n;i++)
		{
			if(not vis[i])
			{
				int r=dfs(i,0);
				if(r)rem.push_back(r);
			}
		}
		cout<<ans.size()<<"\n";
		for(unsigned i=0;i<rem.size();i+=2)
			ans.emplace_back(rem[i],rem[i+1]);
		for(auto [u,v]:ans)
		{
			cout<<u<<' '<<v<<"\n";
		}
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok ok (3 test cases)

Test #2:

score: 0
Accepted
time: 85ms
memory: 3504kb

input:

10000
2
-107276936 -310501829
419434212 585811870
-65754386 -491212232
381152038 897148193
3
-474045168 493506332
299114415 540203303
165808153 983551
-506936261 -694189769
766718170 -725540031
975267148 -593051087
1
-818952276 -762387923
584023914 -612401389
6
-77701228 -266484128
659434465 6322062...

output:

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

result:

ok ok (10000 test cases)

Test #3:

score: 0
Accepted
time: 87ms
memory: 3524kb

input:

10000
1
999855386 999580905
999342928 999615227
21
999601032 999015398
999155628 999176944
999309856 999524434
999121011 999509537
999323572 999685730
999272272 999769606
999450559 999390758
999632027 999178534
999024993 999463838
999784856 999374197
999980525 999366771
999241260 999516879
999599548...

output:

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

result:

ok ok (10000 test cases)

Test #4:

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

input:

10000
5
999984799 999981445
999958394 999984217
999994978 999981258
999955539 999938710
999936554 999963561
999907222 999907508
999938166 999941959
999910567 999986887
999901446 999961092
999994730 999963038
5
999916115 999962400
999948250 999940355
999954204 999920844
999928148 999990369
999978118 ...

output:

0
1 2
3 4
5 6
7 8
9 10
0
1 2
3 4
5 6
7 8
9 10
0
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
0
1 2
3 4
5 6
7 8
0
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
0
1 2
3 4
5 6
7 8
9 10
0
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
0
1 2
3 4
5 6
7 8
9 10
1...

result:

ok ok (10000 test cases)

Test #5:

score: 0
Accepted
time: 86ms
memory: 3484kb

input:

10000
1
999990146 999993828
999995909 999996353
56
999999851 999991179
999997250 999997987
999990590 999997316
999997350 999996856
999997034 999996236
999999396 999996897
999991180 999993309
999991265 999995185
999993952 999994054
999990210 999994471
999993201 999995893
999997170 999998971
999998201...

output:

0
1 2
1
76 111
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 77
78 79
80 81
82 83
84 85
86 87
88 89
90 91
92 93
94 95
96 97
98 99
...

result:

ok ok (10000 test cases)

Test #6:

score: 0
Accepted
time: 76ms
memory: 3480kb

input:

10000
5
999999432 999999813
999999271 999999233
999999043 999999606
999999523 999999406
999999564 999999274
999999641 999999102
999999903 999999858
999999058 999999098
999999974 999999119
999999643 999999620
5
999999370 999999738
999999181 999999907
999999163 999999783
999999393 999999086
999999661 ...

output:

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

result:

ok ok (10000 test cases)

Test #7:

score: 0
Accepted
time: 81ms
memory: 3504kb

input:

10000
14
-369804569 -904204119
526374829 -824374353
-127549933 -904204119
-68608787 929413707
-68608787 -363454459
526374829 929413707
693313139 -824374353
-127549933 -726843762
526374829 -904204119
526374829 -363454459
526374829 -409731440
693313139 -726843762
693313139 929413707
-68608787 -8243743...

output:

14
24 28
12 13
27 7
14 23
4 5
26 16
19 22
8 18
17 3
10 15
6 9
11 2
21 25
1 20
20
9 34
36 40
26 33
35 15
16 20
6 5
21 12
29 30
24 27
37 13
11 23
28 31
10 8
32 38
4 7
39 22
19 25
14 17
18 2
1 3
8
14 16
11 12
5 9
15 10
3 13
4 2
7 8
1 6
1
1 2
1
1 2
34
64 65
56 62
35 36
66 6
50 58
42 44
25 33
4 21
68 32
...

result:

ok ok (10000 test cases)

Test #8:

score: 0
Accepted
time: 81ms
memory: 3564kb

input:

10000
5
-536123007 813600068
870612905 -192916365
-891077277 -192916365
-169354047 -86845158
-204880568 -86845158
-909192812 -613162163
-536123007 -613162163
602684169 -613162163
-909192812 813600068
602684169 -86845158
3
-296375355 579758813
-296375355 253508589
-296375355 -927878827
267975935 -927...

output:

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

result:

ok ok (10000 test cases)

Test #9:

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

input:

10000
13
38708650 -400244265
805800882 -207412170
-922757982 569623504
330308285 -400244265
-922757982 193222226
330308285 -701148819
-28889088 854967427
284328781 704931219
-397379302 854967427
284328781 252366771
-699696493 -701148819
953729077 -601089169
-858131099 -701148819
-397379302 193222226...

output:

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

result:

ok ok (10000 test cases)

Test #10:

score: 0
Accepted
time: 74ms
memory: 3460kb

input:

10000
2
-254673318 743896676
326182652 743896676
115024593 743896676
989112001 743896676
1
453875458 284043499
869627863 284043499
8
-68955663 625858753
-621253434 625858753
-315653340 625858753
-85160525 625858753
-592616333 625858753
114285020 625858753
618762545 625858753
524402507 625858753
1512...

output:

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

result:

ok ok (10000 test cases)

Test #11:

score: 0
Accepted
time: 64ms
memory: 3564kb

input:

10000
10
-302093372 -991014187
542702243 714369751
-370626462 -991014187
-700169063 714369751
-982732066 -991014187
-763837020 -991014187
320477527 -991014187
290144737 -991014187
18975042 -991014187
-339021181 -991014187
-525462052 -991014187
290144737 714369751
-538375359 714369751
15943074 -99101...

output:

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

result:

ok ok (10000 test cases)

Test #12:

score: 0
Accepted
time: 76ms
memory: 3500kb

input:

10000
5
192354975 -209258445
955055576 -209258445
286707627 -209258445
-574795734 -209258445
-305243931 -209258445
-629755833 -209258445
-337515030 -209258445
980285884 -209258445
501317910 -209258445
312382135 -209258445
24
272466007 467288536
-963587196 -778274012
240097765 -778274012
-926564605 4...

output:

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

result:

ok ok (10000 test cases)

Test #13:

score: 0
Accepted
time: 78ms
memory: 3528kb

input:

10000
11
135813326 608040171
135813326 -96255413
135813326 -31734533
135813326 -423296887
135813326 999444876
135813326 946760362
135813326 -599331154
135813326 -441599790
135813326 233339336
135813326 -759375115
135813326 163868817
135813326 321091518
135813326 -402236877
135813326 625124369
135813...

output:

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

result:

ok ok (10000 test cases)

Test #14:

score: 0
Accepted
time: 75ms
memory: 3472kb

input:

10000
19
321791336 -226466052
321791336 138757626
321791336 -613429828
944682716 -446131303
321791336 -927463006
944682716 280242351
944682716 229347131
944682716 155568891
321791336 389911916
944682716 72836839
944682716 -613429828
321791336 229347131
944682716 -927463006
944682716 138757626
321791...

output:

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

result:

ok ok (10000 test cases)

Test #15:

score: 0
Accepted
time: 66ms
memory: 3528kb

input:

10000
2
414226098 -53411011
414226098 -515361565
-572270323 -515361565
-572270323 -53411011
36
660074753 623771687
-917096747 533975361
660074753 337851674
-917096747 -902052044
-917096747 846238046
660074753 197157825
660074753 533975361
660074753 626049519
-917096747 -108293477
-917096747 64055247...

output:

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

result:

ok ok (10000 test cases)

Test #16:

score: 0
Accepted
time: 65ms
memory: 3560kb

input:

10000
6
475408912 -758469962
-99052258 -758469962
-716758863 872897211
-66386054 -170278720
388817201 174925294
-776227900 -285032873
475408912 872897211
-997698204 -236300379
-716758863 -85108619
-776227900 -85108619
-716758863 -236300379
-66386054 -85108619
26
879874105 877328664
-286895493 621573...

output:

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

result:

ok ok (10000 test cases)

Test #17:

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

input:

10000
9
-980409638 -116749812
830791554 -690170434
984923479 323045898
984923479 -116749812
-197520273 323045898
-858897130 -43820432
258471629 -979749918
258471629 -690170434
-858897130 323045898
105960247 -690170434
-197520273 -841854666
-234415044 -116749812
105960247 323045898
-358435325 -202957...

output:

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

result:

ok ok (10000 test cases)

Test #18:

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

input:

1000
45
840710004 395646135
-851514725 100215150
-423513540 -649756636
464326407 -482837664
-179781718 755995077
492651722 -268519233
367302062 -111998374
494634876 842096727
973319201 399526783
-703731734 -989899930
758934136 -959677785
-682507454 58961947
394206800 272218663
752299573 489795348
89...

output:

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

result:

ok ok (1000 test cases)

Test #19:

score: 0
Accepted
time: 109ms
memory: 3884kb

input:

1000
113
999827252 999728856
999923862 999631025
999319008 999580013
999333375 999174260
999509073 999545469
999194399 999278837
999715162 999728030
999881205 999764413
999917667 999953211
999651496 999869003
999693536 999169883
999545275 999786246
999969774 999735073
999892216 999697498
999954099 9...

output:

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

result:

ok ok (1000 test cases)

Test #20:

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

input:

1000
16
999918424 999907758
999901558 999910407
999969229 999929343
999986216 999968746
999977167 999921267
999967186 999932634
999999615 999951539
999964903 999931387
999942189 999989158
999990624 999917294
999964661 999935732
999971224 999975496
999972707 999972034
999935060 999934824
999992448 99...

output:

0
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
0
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
0
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 ...

result:

ok ok (1000 test cases)

Test #21:

score: 0
Accepted
time: 103ms
memory: 3880kb

input:

1000
227
999994296 999999816
999998835 999994618
999998487 999991646
999995178 999996563
999996865 999996231
999990660 999996917
999995746 999998295
999993178 999995596
999994361 999991179
999990519 999991221
999996210 999992041
999991924 999992546
999991346 999991081
999998929 999995904
999992182 9...

output:

21
3 253
9 363
10 163
22 49
43 351
90 247
100 176
109 278
112 231
124 368
128 436
135 145
142 448
148 177
172 367
180 203
235 322
263 300
297 405
315 378
340 442
1 2
4 5
6 7
8 11
12 13
14 15
16 17
18 19
20 21
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
44 45
46 47
48 50
51 52
53 54
5...

result:

ok ok (1000 test cases)

Test #22:

score: 0
Accepted
time: 116ms
memory: 3728kb

input:

1000
87
999999138 999999640
999999785 999999342
999999914 999999854
999999771 999999416
999999011 999999479
999999217 999999865
999999423 999999937
999999684 999999301
999999323 999999399
999999071 999999949
999999226 999999154
999999770 999999090
999999778 999999735
999999034 999999517
999999803 99...

output:

23
6 70
10 75
12 98
15 23
16 162
26 104
27 39
86 120
47 165
51 124
54 80
56 121
65 115
71 84
72 112
139 135
111 166
92 132
131 149
142 155
143 161
158 168
159 164
1 2
3 4
5 17
7 8
9 11
13 14
18 19
20 21
22 24
25 83
28 29
30 31
32 33
34 35
36 37
38 40
41 42
43 44
45 46
48 49
50 52
53 55
57 58
59 60
6...

result:

ok ok (1000 test cases)

Test #23:

score: 0
Accepted
time: 73ms
memory: 3740kb

input:

1000
154
825004796 802565417
-88001579 364640592
778546546 -57508543
283686672 -57508543
473326798 -826011553
152069566 -577222261
528378065 -577222261
-56296909 -700802856
-711386984 953035370
-711386984 -577222261
895677144 -359290436
840183000 364640592
528378065 -752921798
895677144 -577222261
8...

output:

154
285 304
252 264
224 248
206 220
107 150
82 90
50 51
12 44
308 15
292 302
260 278
216 217
193 212
170 172
111 143
56 104
141 32
275 296
243 253
221 226
157 175
121 156
77 114
73 74
25 41
283 46
247 267
176 239
147 154
110 120
92 105
29 60
306 136
246 272
238 242
219 231
158 215
127 129
87 99
76 8...

result:

ok ok (1000 test cases)

Test #24:

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

input:

1000
63
859289659 -203061342
831821977 -778714404
640602188 478366497
205686723 -232506600
831821977 -498015901
-494818974 35295117
612307834 -234198721
612307834 -495294231
-898414633 476295237
995217164 -232506600
831821977 934046031
-441937174 432603845
995217164 938111737
874550198 -309423823
87...

output:

63
88 111
112 114
64 77
55 105
66 17
20 46
89 91
99 123
90 94
50 100
40 47
81 9
36 96
10 13
4 63
121 103
113 126
51 83
32 19
107 117
116 124
104 110
14 15
72 98
38 49
119 12
54 74
41 42
97 6
73 84
34 58
76 125
48 3
7 8
108 101
67 102
44 61
53 33
29 85
23 26
122 75
106 109
70 79
93 115
35 57
80 87
43...

result:

ok ok (1000 test cases)

Test #25:

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

input:

1000
83
-242219535 -952757420
753940135 -13368420
-180286961 -530756654
586180284 -625675517
-437809383 472014390
-242857851 -924097244
-382920283 -625675517
-630990620 -349004314
-242219535 122507147
208821889 -495849186
-736086757 -489441806
-996984615 -974276781
-275306966 -25109596
967186464 -65...

output:

83
125 114
164 155
126 156
140 162
117 146
72 118
48 147
141 157
136 113
109 122
97 123
151 60
75 107
73 82
150 96
137 111
115 25
45 10
139 154
131 101
89 40
39 144
92 142
36 127
98 46
35 83
132 33
90 130
85 129
57 76
38 62
16 65
71 86
27 100
34 47
91 56
148 37
128 112
134 160
105 7
110 87
138 21
67...

result:

ok ok (1000 test cases)

Test #26:

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

input:

1000
142
-28949259 975363136
-628367037 975363136
786525293 975363136
-8339801 975363136
868048337 975363136
208733157 975363136
-724415150 975363136
213367214 975363136
-686387505 975363136
-970451747 975363136
761135553 975363136
-551594491 975363136
-925080593 975363136
-243465321 975363136
-6722...

output:

142
283 284
281 282
279 280
277 278
275 276
273 274
271 272
269 270
267 268
265 266
263 264
261 262
259 260
257 258
255 256
253 254
251 252
249 250
247 248
245 246
243 244
241 242
239 240
237 238
235 236
233 234
231 232
229 230
227 228
225 226
223 224
221 222
219 220
217 218
215 216
213 214
211 212
...

result:

ok ok (1000 test cases)

Test #27:

score: 0
Accepted
time: 106ms
memory: 3952kb

input:

1000
458
102600109 754726017
-66999931 951825513
-767202008 951825513
-845069119 754726017
-448344214 754726017
174342794 754726017
176530329 754726017
553731053 754726017
-69189351 754726017
-455330522 951825513
-261324017 754726017
809818684 951825513
745593756 951825513
-130095774 754726017
-2737...

output:

458
912 916
890 894
908 913
899 900
891 893
889 901
874 887
844 854
839 840
902 825
868 884
862 866
853 860
836 842
863 805
829 830
814 820
811 813
786 791
774 785
769 772
802 784
910 801
855 751
787 790
768 778
750 885
818 749
909 765
747 748
763 764
850 761
729 738
726 723
756 760
705 815
755 795
...

result:

ok ok (1000 test cases)

Test #28:

score: 0
Accepted
time: 110ms
memory: 3880kb

input:

1000
273
638010636 -796267612
299279783 -796267612
321987052 -571635029
-388046291 -571635029
-491314021 -796267612
130988206 -571635029
32427063 -571635029
51875304 -571635029
-508530089 -796267612
269379692 -571635029
214241513 -796267612
720122947 -796267612
-678543365 -796267612
158504867 -79626...

output:

273
545 546
542 543
540 541
532 533
516 518
513 515
508 510
500 505
488 499
485 487
470 476
457 462
454 456
446 453
468 435
536 537
523 531
521 522
517 520
511 514
495 501
489 493
483 486
475 482
466 471
424 478
421 422
409 414
402 408
398 399
463 503
460 461
452 455
467 449
534 392
447 448
443 444
...

result:

ok ok (1000 test cases)

Test #29:

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

input:

1000
75
429681826 802800421
429681826 -608943566
429681826 -787858696
429681826 507047252
429681826 485971873
429681826 -346306621
429681826 -612405192
429681826 -13671560
429681826 -816374335
429681826 513226316
429681826 892335083
429681826 -352600432
429681826 -556540475
429681826 -504699273
4296...

output:

75
149 150
147 148
145 146
143 144
141 142
139 140
137 138
135 136
133 134
131 132
129 130
127 128
125 126
123 124
121 122
119 120
117 118
115 116
113 114
111 112
109 110
107 108
105 106
103 104
101 102
99 100
97 98
95 96
93 94
91 92
89 90
87 88
85 86
83 84
81 82
79 80
77 78
75 76
73 74
71 72
69 70
...

result:

ok ok (1000 test cases)

Test #30:

score: 0
Accepted
time: 101ms
memory: 4092kb

input:

1000
81
403001151 -229966312
-27290952 -941247950
-27290952 -872808715
403001151 -81762908
403001151 825473197
403001151 730971412
403001151 -886560490
-27290952 394200417
-27290952 808677817
-27290952 -961778274
-27290952 -245434545
403001151 318019109
-27290952 792029613
403001151 390473732
-27290...

output:

81
157 160
155 156
153 154
151 152
146 150
140 143
138 139
135 136
132 133
130 131
127 128
123 126
116 122
114 115
111 112
109 110
107 108
102 106
100 101
97 99
91 94
83 84
81 82
77 78
72 76
64 71
59 63
47 50
45 46
40 44
38 39
33 35
30 32
26 27
24 25
21 23
17 19
13 15
9 10
3 8
11 2
161 162
158 159
1...

result:

ok ok (1000 test cases)

Test #31:

score: 0
Accepted
time: 97ms
memory: 4056kb

input:

1000
257
-24981531 -524783010
-24981531 376842743
132542945 905111237
-24981531 -663183576
132542945 238995240
-24981531 -904084630
132542945 330336577
-24981531 -424310756
132542945 26224857
-24981531 573604180
132542945 -531956470
132542945 583434945
132542945 620552707
-24981531 -351085713
132542...

output:

257
512 514
510 511
507 509
503 504
500 501
496 497
494 495
492 493
484 489
482 483
472 480
467 469
464 465
460 462
457 459
451 456
447 448
443 445
440 441
437 439
434 435
427 429
423 426
419 422
417 418
412 414
410 411
408 409
401 403
396 400
394 395
389 391
387 388
382 384
379 380
376 377
374 375
...

result:

ok ok (1000 test cases)

Test #32:

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

input:

1000
21
541263298 571344162
-338833794 258719906
814556806 571344162
749911951 -730958945
-737751671 400747496
880311857 -204125795
-555645311 -832036787
-338833794 -832036787
582588235 -915718735
-124654808 394321598
-202932677 571344162
541263298 -975674793
880311857 -730958945
-126659351 25871990...

output:

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

result:

ok ok (1000 test cases)

Test #33:

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

input:

1000
82
620344713 761205214
564192450 -149133296
855072748 -725730286
-369866361 761205214
-126903403 123500699
521658307 -238068427
564192450 -575382074
424528213 639391487
160949070 -238068427
490683515 736060786
-861287945 -430077137
92203881 -414548921
-228263452 -161807552
-739623881 619906932
...

output:

79
108 48
1 4
148 161
90 12
50 15
160 33
54 146
118 139
28 22
144 99
93 101
64 140
141 59
66 107
136 47
45 62
132 53
26 103
159 120
14 114
142 131
111 138
80 115
16 76
149 156
42 162
86 35
69 153
75 39
100 113
52 30
56 152
154 36
109 5
92 151
8 105
31 119
88 126
84 18
71 155
10 158
147 46
133 135
77...

result:

ok ok (1000 test cases)

Test #34:

score: 0
Accepted
time: 143ms
memory: 6520kb

input:

100
715
-716037174 449787280
-179603495 267807227
-85847745 -339745287
531498593 906672966
-65182647 -249655497
196101865 -917254384
569704541 175181937
408949063 -60772621
-471098833 -180592225
452882519 -173474204
518554869 504642822
-610596606 -43048739
-173418328 49620755
-490214353 129314297
-8...

output:

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

result:

ok ok (100 test cases)

Test #35:

score: 0
Accepted
time: 145ms
memory: 5260kb

input:

100
1180
999939181 999607824
999877463 999501538
999725395 999197028
999578614 999669422
999691207 999388141
999798382 999350154
999515140 999686861
999804739 999722876
999059909 999779016
999988075 999795096
999394228 999790648
999357316 999130743
999834412 999146926
999533794 999419507
999164265 9...

output:

2
294 1956
485 2069
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
9...

result:

ok ok (100 test cases)

Test #36:

score: 0
Accepted
time: 137ms
memory: 5344kb

input:

100
10
999949463 999921247
999942779 999933524
999900374 999919960
999913527 999977190
999963539 999919222
999986393 999982382
999960627 999912715
999955900 999934316
999962876 999904282
999944172 999923360
999974177 999993968
999960412 999941887
999902083 999920318
999906832 999942948
999934454 999...

output:

0
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
0
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...

result:

ok ok (100 test cases)

Test #37:

score: 0
Accepted
time: 139ms
memory: 5216kb

input:

100
2795
999995625 999994422
999997406 999998890
999996073 999998910
999996365 999992345
999992211 999999534
999990826 999998894
999990827 999999648
999991569 999997094
999997323 999994792
999990812 999994722
999994392 999998879
999994441 999990381
999992051 999993298
999997822 999994423
999998285 9...

output:

1710
1620 2955
1221 2278
1 1185
2121 2936
4782 887
2 3704
3 2184
4 3332
3944 3365
5 2607
3120 5539
256 1753
2471 3767
2269 3598
2883 856
8 492
4161 5579
3655 5453
1042 3895
3648 4480
2165 2576
12 2218
2449 1816
5016 1665
13 3779
4294 3453
14 188
1815 2481
1596 2889
4914 453
4200 4026
3975 1999
1788 ...

result:

ok ok (100 test cases)

Test #38:

score: 0
Accepted
time: 109ms
memory: 5292kb

input:

100
1005
999999258 999999564
999999716 999999506
999999057 999999959
999999274 999999385
999999562 999999714
999999749 999999926
999999159 999999330
999999060 999999408
999999218 999999582
999999097 999999761
999999853 999999231
999999424 999999841
999999744 999999186
999999400 999999073
999999445 9...

output:

985
1465 827
476 109
1151 1058
959 1707
1067 752
399 1448
967 794
655 905
1657 1203
1293 1319
1008 1211
1704 1332
1385 964
842 893
1386 1926
800 1911
1976 425
1324 1676
1137 1653
1141 1967
1090 889
720 1564
1567 1588
1382 1260
1350 744
1942 490
1759 1890
346 114
1560 1388
1397 717
523 585
1546 1755
...

result:

ok ok (100 test cases)

Test #39:

score: 0
Accepted
time: 84ms
memory: 5484kb

input:

100
174
-958876330 -846470800
-796741809 -131152725
574295122 764287642
-958876330 -825762193
185468313 -971066749
-287559769 764287642
-904746093 -825762193
-438778854 -825762193
5267152 609322023
185468313 77515090
185468313 -131152725
-287559769 247199580
-491475497 260165013
719679418 -179087066...

output:

174
336 345
297 331
263 281
192 196
151 154
129 146
62 99
32 58
327 13
333 335
299 303
277 296
264 275
238 256
217 222
134 156
127 132
36 48
337 47
315 316
258 272
241 254
185 237
163 164
131 162
53 115
15 17
108 14
312 319
291 301
247 278
231 234
221 230
130 148
109 123
64 68
59 63
339 158
240 253
...

result:

ok ok (100 test cases)

Test #40:

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

input:

100
454
292487349 -708917766
-446575764 -920302303
373857024 -525302786
236159958 -877034512
240035307 -28559828
-156425976 29793081
-683968223 -28559828
658545653 -892201965
-485118423 -349005511
-677465608 102959577
-241309351 -615266668
-857580103 -877034512
590882873 69859569
-961101806 -2385646...

output:

454
663 797
745 767
682 684
632 619
628 723
813 895
834 904
371 562
906 841
660 872
810 527
799 736
823 825
862 817
880 798
688 759
681 603
540 782
747 772
655 740
608 678
710 613
694 648
890 891
764 845
654 665
693 903
550 591
555 508
281 443
652 277
469 874
332 338
315 318
169 766
215 265
758 683
...

result:

ok ok (100 test cases)

Test #41:

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

input:

100
140
229220674 878836488
-506767178 293730975
960642833 878836488
485659386 878836488
-225376185 16183205
-322465048 -460955536
-635701181 878836488
-578723152 374559636
956924322 878836488
-666563369 -550449367
-240963901 374559636
9519098 374559636
404598294 16183205
-188062738 467646265
937074...

output:

140
280 110
258 277
230 202
240 217
206 219
137 178
198 153
245 182
232 236
186 224
207 135
78 205
237 136
145 222
275 142
141 146
243 191
165 234
190 113
126 160
269 94
143 239
262 128
168 109
188 131
192 213
259 77
233 93
106 223
61 114
172 127
271 92
98 248
247 74
155 215
212 180
51 179
254 272
6...

result:

ok ok (100 test cases)

Test #42:

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

input:

100
453
-9728842 -879506383
723264369 -879506383
-617602947 -879506383
-883543546 -879506383
-365459776 -879506383
259863014 -879506383
-229024413 -879506383
-357634378 -879506383
45613473 -879506383
897413515 -879506383
142722904 -879506383
308356916 -879506383
-528467703 -879506383
45803942 -87950...

output:

453
905 906
903 904
901 902
899 900
897 898
895 896
893 894
891 892
889 890
887 888
885 886
883 884
881 882
879 880
877 878
875 876
873 874
871 872
869 870
867 868
865 866
863 864
861 862
859 860
857 858
855 856
853 854
851 852
849 850
847 848
845 846
843 844
841 842
839 840
837 838
835 836
833 834
...

result:

ok ok (100 test cases)

Test #43:

score: 0
Accepted
time: 356ms
memory: 5832kb

input:

100
1681
-648014211 -216027092
-372352298 95789050
-678908480 95789050
-382412165 95789050
214922606 95789050
45021991 95789050
131451784 95789050
926607022 -216027092
-500711391 95789050
527775426 -216027092
860331657 95789050
-255764825 95789050
314154093 -216027092
-631103238 95789050
292792358 9...

output:

1681
3353 3362
3346 3348
3344 3345
3338 3340
3335 3337
3323 3328
3309 3319
3302 3306
3297 3299
3292 3293
3284 3289
3280 3283
3277 3279
3266 3271
3260 3265
3253 3258
3244 3245
3230 3236
3219 3221
3204 3206
3190 3200
3183 3184
3178 3180
3160 3172
3152 3157
3123 3130
3119 3122
3110 3113
3105 3106
3097 ...

result:

ok ok (100 test cases)

Test #44:

score: 0
Accepted
time: 297ms
memory: 5224kb

input:

100
476
218894313 -685169320
967098661 -16626457
-797375436 -16626457
955557493 -16626457
54133572 -16626457
-722192690 -16626457
791557373 -16626457
-208166285 -685169320
185917393 -16626457
-338707386 -16626457
49911294 -16626457
-359502368 -685169320
-359176146 -685169320
430103061 -16626457
-744...

output:

476
948 951
941 947
928 937
913 924
888 902
898 887
943 949
931 939
840 878
826 832
813 819
923 894
914 920
903 909
882 895
870 874
899 867
804 805
886 799
864 866
929 863
784 792
862 835
853 855
780 858
841 770
905 817
848 763
800 812
759 823
755 756
736 740
732 735
777 724
788 796
781 785
723 893
...

result:

ok ok (100 test cases)

Test #45:

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

input:

100
1281
-7127937 -551225280
-7127937 -63829747
-7127937 50255920
-7127937 685959203
-7127937 -474730627
-7127937 205475943
-7127937 894868084
-7127937 -262984557
-7127937 858324856
-7127937 257534742
-7127937 -640954010
-7127937 -111367493
-7127937 892100661
-7127937 696606550
-7127937 136498536
-7...

output:

1281
2561 2562
2559 2560
2557 2558
2555 2556
2553 2554
2551 2552
2549 2550
2547 2548
2545 2546
2543 2544
2541 2542
2539 2540
2537 2538
2535 2536
2533 2534
2531 2532
2529 2530
2527 2528
2525 2526
2523 2524
2521 2522
2519 2520
2517 2518
2515 2516
2513 2514
2511 2512
2509 2510
2507 2508
2505 2506
2503 ...

result:

ok ok (100 test cases)

Test #46:

score: 0
Accepted
time: 301ms
memory: 5248kb

input:

100
2300
930979038 -865442548
56354538 569246647
930979038 209346563
930979038 -402151796
56354538 9788037
930979038 349210639
930979038 113353815
56354538 -508882748
56354538 -390359400
930979038 881411592
56354538 328521324
56354538 569030395
56354538 749112678
930979038 -492654973
930979038 -5806...

output:

2300
4599 4600
4597 4598
4592 4595
4589 4591
4585 4586
4580 4582
4572 4579
4569 4570
4565 4567
4563 4564
4561 4562
4556 4559
4552 4554
4542 4545
4539 4540
4535 4536
4526 4534
4524 4525
4520 4523
4515 4518
4512 4514
4506 4511
4502 4504
4498 4501
4492 4497
4489 4491
4479 4487
4475 4477
4473 4474
4467 ...

result:

ok ok (100 test cases)

Test #47:

score: 0
Accepted
time: 308ms
memory: 5400kb

input:

100
393
484804995 -671233294
484804995 45381500
-343734967 483744892
-343734967 -678278044
-343734967 430018594
484804995 -536133521
-343734967 972761171
-343734967 188883545
484804995 291634094
484804995 161326893
484804995 43447237
-343734967 81642646
-343734967 905579532
484804995 -838456546
4848...

output:

393
785 786
781 782
777 780
772 774
769 770
766 768
764 765
759 761
756 757
751 753
748 749
746 747
740 745
733 735
730 732
725 729
722 723
718 719
712 714
710 711
701 702
697 700
690 691
688 689
684 685
680 683
676 679
672 674
667 668
665 666
660 664
656 657
654 655
652 653
644 647
642 643
640 641
...

result:

ok ok (100 test cases)

Test #48:

score: 0
Accepted
time: 185ms
memory: 6328kb

input:

100
2245
257511569 -570888823
-409065975 834451934
972932318 -206332685
-220073979 -895107571
819486773 -206332685
819823298 -570888823
116295608 282026121
589205449 -895107571
-54658019 -895107571
987042524 -206332685
-196884689 282026121
-940822451 993058719
402874649 -895107571
633334868 99305871...

output:

2245
4404 4483
3776 3868
4269 4397
4066 3772
4054 4117
4038 4043
4419 4429
4186 4216
4127 3897
3919 4083
3742 4336
4016 3702
4337 4349
4279 4289
4193 4253
4060 4068
3848 4034
4389 3854
4178 4190
4229 3811
4326 3765
4324 4405
4046 4222
3741 4130
3732 4098
3861 3886
3684 4116
3846 3594
3907 3705
3970 ...

result:

ok ok (100 test cases)

Test #49:

score: 0
Accepted
time: 119ms
memory: 5160kb

input:

100
116
-28349829 -267772969
-181233169 605639981
-221792554 885875755
-8847461 376377302
-527881168 376377302
-794286947 885875755
-442516480 365428090
60367949 59687335
844852200 -267772969
70152464 -267772969
-326579976 59687335
-382146420 885875755
-305012413 376377302
-255659827 495623398
84485...

output:

116
120 163
165 215
131 135
153 203
146 147
211 227
181 197
168 210
176 179
193 230
220 231
189 199
108 142
117 89
173 177
174 161
214 232
158 187
119 209
195 118
169 157
223 229
141 143
184 140
144 148
221 134
74 180
105 125
137 93
228 127
123 126
192 202
190 191
138 188
216 133
172 167
116 124
150...

result:

ok ok (100 test cases)

Test #50:

score: 0
Accepted
time: 236ms
memory: 14288kb

input:

10
10568
266619539 928993099
644537002 -163339024
-965315605 131093436
-873401839 -319727236
-682029920 -699502948
-857838819 -528950378
126750467 -72275669
623580094 410832833
287731394 -865265684
-71034303 515678565
-897514612 929674238
-794392375 895647772
811715826 600060479
640892543 -557248887...

output:

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

result:

ok ok (10 test cases)

Test #51:

score: 0
Accepted
time: 245ms
memory: 16336kb

input:

10
983
999595593 999481588
999941833 999204986
999676040 999115470
999653065 999524261
999950018 999574889
999911879 999942071
999134864 999155033
999133604 999956453
999424191 999531479
999169859 999553795
999163364 999608732
999486991 999180185
999600255 999690901
999278724 999959357
999886640 999...

output:

2
931 1118
997 1034
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
9...

result:

ok ok (10 test cases)

Test #52:

score: 0
Accepted
time: 225ms
memory: 10596kb

input:

10
15236
999975325 999978324
999983228 999957461
999965056 999943264
999953829 999920806
999913911 999975263
999949326 999952997
999948654 999968342
999957007 999987426
999900723 999909965
999944389 999907733
999911075 999973513
999997298 999931066
999983079 999918568
999946266 999969557
999900152 9...

output:

6279
9221 15324
4 27113
11400 2722
5 28786
7 9927
9 8081
11 11290
12 5876
15254 7689
18 1462
52 11061
4166 10190
21 6507
23 9346
25 3278
26 6461
28 1198
25448 28213
30 3059
32 28159
12391 12950
14326 16560
3251 18295
21454 13426
38 10208
40 710
13298 13596
41 7797
7415 13553
25582 2061
3944 22445
26...

result:

ok ok (10 test cases)

Test #53:

score: 0
Accepted
time: 171ms
memory: 13460kb

input:

10
6642
999992808 999996636
999995238 999998603
999990460 999998357
999992495 999998027
999994992 999993315
999990663 999999307
999994510 999991024
999994319 999993024
999996312 999990447
999990590 999994561
999997748 999994786
999990918 999993436
999994457 999993851
999994234 999991647
999996595 99...

output:

6031
11617 12767
987 8332
7892 6209
9839 3792
10601 10418
1045 1689
1289 6891
209 3788
1128 2770
9672 2115
10308 1697
4475 5573
761 6203
9369 7899
1245 4804
2373 8728
12024 3150
3551 5577
2972 11304
4314 6202
10495 11886
12819 1730
7398 7529
2388 9282
5872 13098
3363 9042
7290 8307
6521 888
7130 542...

result:

ok ok (10 test cases)

Test #54:

score: 0
Accepted
time: 103ms
memory: 11020kb

input:

10
19516
999999707 999999837
999999488 999999818
999999509 999999591
999999991 999999026
999999356 999999726
999999489 999999193
999999038 999999298
999999881 999999157
999999344 999999162
999999160 999999113
999999139 999999582
999999470 999999327
999999742 999999921
999999255 999999737
999999216 9...

output:

19516
37598 38611
35657 38890
38156 38500
37925 38059
37414 38490
37411 37493
37326 38675
37271 37746
37978 38886
37210 37230
34946 35026
33743 34304
37875 38012
35754 37600
33463 35690
31398 33177
30229 30872
27094 30200
26538 26613
25637 26257
23119 24833
21668 22730
20766 20824
37861 38733
34033 ...

result:

ok ok (10 test cases)

Test #55:

score: 0
Accepted
time: 128ms
memory: 11024kb

input:

10
14948
-170688734 833794743
949001579 224632065
-887648481 346146784
994218765 -808897932
948269970 764123696
24957273 562441566
-170688734 843621240
959643634 -354951661
631351081 -86364881
-9691567 824383620
-935916525 352437858
381851425 387057559
-6239193 951794229
450798340 -742525732
-394344...

output:

14948
29644 29675
29420 29518
29016 29088
28642 28664
28545 28574
28311 28327
28016 28060
27697 27757
27552 27663
27288 27516
27180 27254
26525 26851
26307 26462
26114 26281
25903 25909
25648 25706
25460 25575
24978 25171
24622 24820
23344 24025
22676 23195
21884 22146
21168 21665
20557 20827
20384 ...

result:

ok ok (10 test cases)

Test #56:

score: 0
Accepted
time: 112ms
memory: 10268kb

input:

10
18275
46937162 -785699925
-512599977 -861792903
-732947245 771605479
-317815822 369273432
-478775873 211331712
-678678382 -401598442
-366699505 752973691
776710779 -7216385
-88306688 -190102574
328516250 -317225669
522217639 215990988
523904534 -256490677
540608168 493241721
620782210 -185524925
...

output:

18275
36065 36519
35899 36439
35742 36415
35986 36302
35623 35700
35083 35451
34137 34735
33534 33851
29873 30812
35220 36208
36284 36324
34330 35055
33068 34224
32087 32128
31725 31864
31284 31687
31143 31184
30561 30797
29304 30541
27798 29125
26470 26799
25412 26226
25180 25258
23069 23679
21163 ...

result:

ok ok (10 test cases)

Test #57:

score: 0
Accepted
time: 175ms
memory: 13340kb

input:

10
390
-347835130 869197644
963535733 392603688
671237510 92351133
671237510 -703861232
671237510 423461538
671237510 369343656
671237510 980877320
-347835130 456099182
671237510 -311676199
-347835130 -886266831
-347835130 -257100015
-347835130 -637839633
963535733 -16989823
963535733 -821875052
963...

output:

390
774 778
762 768
760 761
754 755
743 744
740 742
735 736
732 734
730 731
724 728
719 720
716 717
714 715
711 712
709 710
705 708
699 702
694 698
682 685
675 677
672 673
668 670
662 666
654 657
649 652
647 648
641 646
639 640
634 635
628 631
620 621
609 617
602 603
596 600
593 594
582 587
566 580
...

result:

ok ok (10 test cases)

Test #58:

score: -100
Time Limit Exceeded

input:

10
1285
637213737 -900998147
-356659628 -900998147
950244610 -900998147
-182671545 -900998147
-708950884 -900998147
-973866581 -900998147
-190878205 -900998147
135731649 -900998147
-125331609 -900998147
521939981 -900998147
976257311 -900998147
818237327 -900998147
705563706 -900998147
58565785 -900...

output:

1285
2569 2570
2567 2568
2565 2566
2563 2564
2561 2562
2559 2560
2557 2558
2555 2556
2553 2554
2551 2552
2549 2550
2547 2548
2545 2546
2543 2544
2541 2542
2539 2540
2537 2538
2535 2536
2533 2534
2531 2532
2529 2530
2527 2528
2525 2526
2523 2524
2521 2522
2519 2520
2517 2518
2515 2516
2513 2514
2511 ...

result: