QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#472689#6414. Classical Maximization ProblemlobserverWA 108ms14140kbC++141.7kb2024-07-11 18:28:342024-07-11 18:28:34

Judging History

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

  • [2024-07-11 18:28:34]
  • 评测
  • 测评结果:WA
  • 用时:108ms
  • 内存:14140kb
  • [2024-07-11 18:28:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=200005;
int x[N],y[N];
int xx[N],yy[N];
int idx,vis[N],ans;
int h[N],ne[N<<1],adj[N<<1],id[N<<1],tp;
int mch[N];
void add(int u,int v,int eid){
	ne[++tp]=h[u];
	h[u]=tp;
	adj[tp]=v;
	id[tp]=eid;
}
int dfs(int u,int fa){
	vector<int> a;
	vis[u]=++idx;
	int fid=0;
	for(int i=h[u];i;i=ne[i]){
		int v=adj[i];
		if(v==fa){
			fid=id[i];
			continue;
		}
		if(vis[v]){
			if(vis[u]>vis[v])a.push_back(id[i]);
			continue;
		}
		if(dfs(v,u))a.push_back(id[i]);
	}
	int l=0;
	for(auto i:a){
		if(l){
			mch[i]=l;
			mch[l]=i;
			l=0;
			ans++;
		}
		else l=i;
	}
	if(l&&fid){
		mch[fid]=l;
		mch[l]=fid;
		ans++;
		return 0;
	}
	return 1;
}
void work(){
	int n;
	cin>>n;n<<=1;
	for(int i=1;i<=n;i++){
		cin>>x[i]>>y[i];
		xx[i]=x[i];
		yy[i]=y[i];
	}
	sort(xx+1,xx+1+n);
	sort(yy+1,yy+1+n);
	int px=unique(xx+1,xx+1+n)-(xx+1);
	int py=unique(yy+1,yy+1+n)-(yy+1);
	
	for(int i=1;i<=n;i++){
		int nx=lower_bound(xx+1,xx+1+px,x[i])-xx;
		int ny=lower_bound(yy+1,yy+1+py,y[i])-yy;
		add(nx,ny+px,i);
		add(ny+px,nx,i);
	}
	
	ans=0;
	for(int i=1;i<=px+py;i++){
		if(vis[i])continue;
		dfs(i,0);
	}
	cout<<ans<<"\n";
	int l=0;
	for(int i=1;i<=n;i++){
		if(mch[i]){
			if(i<mch[i]){
				cout<<i<<" "<<mch[i]<<"\n";
			}
		}
		else{
			if(l){
				cout<<l<<" "<<i<<"\n";
				l=0;
			}
			else l=i;
		}
	}
	
	idx=0;
	for(int i=1;i<=px+py;i++)vis[i]=0;
	for(int i=1;i<=n;i++)mch[i]=0;
	for(int i=1;i<=px+py;i++)h[i]=0;
	for(int i=1;i<=tp;i++)ne[i]=0;
	tp=0;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t;
	cin>>t;
	while(t--)work();
	return 0;
}

詳細信息

Test #1:

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

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

result:

ok ok (3 test cases)

Test #2:

score: 0
Accepted
time: 58ms
memory: 11808kb

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: 57ms
memory: 7872kb

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: 58ms
memory: 7740kb

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: 58ms
memory: 7680kb

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
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
76 111
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: 54ms
memory: 7720kb

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
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
1
1 2
3 4
5 6
7 8
9 10
12 13
11 14
15 16
0
1 2
3 4
0
1 2
3 4
1
1 2
3 4
5 6
7 8
10 44
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: 60ms
memory: 9696kb

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
1 23
2 10
3 27
4 6
5 19
7 28
8 12
9 11
13 18
14 16
15 17
20 24
21 22
25 26
20
1 18
2 14
3 33
4 5
6 16
7 30
8 19
9 36
10 31
11 34
12 21
13 24
15 35
17 23
20 40
22 26
25 39
27 29
28 32
37 38
8
1 5
2 11
3 9
4 13
6 12
7 8
10 15
14 16
1
1 2
1
1 2
34
1 7
2 11
3 59
4 6
5 68
8 50
9 19
10 46
12 14
13 24
1...

result:

ok ok (10000 test cases)

Test #8:

score: 0
Accepted
time: 55ms
memory: 7748kb

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

result:

ok ok (10000 test cases)

Test #9:

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

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

result:

ok ok (10000 test cases)

Test #10:

score: 0
Accepted
time: 47ms
memory: 9720kb

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

result:

ok ok (10000 test cases)

Test #11:

score: 0
Accepted
time: 56ms
memory: 9920kb

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
1 5
2 4
3 9
6 16
7 19
8 12
10 14
11 20
13 15
17 18
10
1 14
2 10
3 11
4 9
5 6
7 18
8 20
12 15
13 17
16 19
18
1 14
2 8
3 36
4 33
5 28
6 18
7 20
9 26
10 12
11 35
13 16
15 24
17 19
21 30
22 27
23 31
25 34
29 32
35
1 64
2 26
3 18
4 5
6 14
7 31
8 36
9 10
11 63
12 33
13 56
15 57
16 19
17 28
20 27
21 22
...

result:

ok ok (10000 test cases)

Test #12:

score: 0
Accepted
time: 57ms
memory: 11736kb

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
1 6
2 3
4 5
7 8
9 10
24
1 27
2 5
3 9
4 8
6 20
7 15
10 21
11 13
12 17
14 44
16 19
18 30
22 35
23 36
24 39
25 40
26 28
29 41
31 42
32 46
33 34
37 38
43 47
45 48
30
1 27
2 41
3 5
4 14
6 22
7 38
8 25
9 29
10 32
11 57
12 21
13 43
15 34
16 59
17 53
18 37
19 44
20 30
23 40
24 26
28 47
31 36
33 35
39 51
4...

result:

ok ok (10000 test cases)

Test #13:

score: 0
Accepted
time: 50ms
memory: 9756kb

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

result:

ok ok (10000 test cases)

Test #14:

score: 0
Accepted
time: 52ms
memory: 11732kb

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

result:

ok ok (10000 test cases)

Test #15:

score: 0
Accepted
time: 57ms
memory: 12036kb

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

result:

ok ok (10000 test cases)

Test #16:

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

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

result:

ok ok (10000 test cases)

Test #17:

score: 0
Accepted
time: 63ms
memory: 7592kb

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

result:

ok ok (10000 test cases)

Test #18:

score: 0
Accepted
time: 67ms
memory: 9748kb

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: 63ms
memory: 11756kb

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: 67ms
memory: 11816kb

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: 63ms
memory: 10020kb

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
1 2
3 253
4 5
6 7
9 363
10 163
8 11
12 13
14 15
16 17
18 19
20 21
22 49
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 351
44 45
46 47
48 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
90 247
89 91
92 93
94 95
9...

result:

ok ok (1000 test cases)

Test #22:

score: 0
Accepted
time: 68ms
memory: 7756kb

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
1 2
3 4
6 70
5 7
8 9
10 75
12 98
11 13
15 23
16 162
14 17
18 19
20 21
22 24
26 104
27 83
25 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
45 46
47 165
48 49
51 124
50 52
54 80
53 55
56 121
57 58
59 60
61 62
63 64
65 115
66 67
68 69
71 110
72 112
73 74
76 77
78 79
81 82
84 85
86 120
87 88
89 ...

result:

ok ok (1000 test cases)

Test #23:

score: 0
Accepted
time: 60ms
memory: 9720kb

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
1 182
2 39
3 184
4 276
5 206
6 7
8 243
9 305
10 24
11 14
12 304
13 299
15 44
16 17
18 165
19 32
20 259
21 58
22 85
23 52
25 41
26 56
27 33
28 76
29 60
30 100
31 71
34 36
35 53
37 69
38 282
40 96
42 45
43 281
46 73
47 102
48 55
49 144
50 51
54 81
57 68
59 84
61 64
62 67
63 89
65 75
66 267
70 77
7...

result:

ok ok (1000 test cases)

Test #24:

score: 0
Accepted
time: 68ms
memory: 7800kb

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
1 95
2 37
3 76
4 10
5 45
6 97
7 58
8 48
9 19
11 126
12 119
13 36
14 72
15 106
16 27
17 105
18 60
20 77
21 34
22 62
23 125
24 59
25 33
26 64
28 52
29 55
30 84
31 38
32 51
35 89
39 120
40 47
41 42
43 49
44 108
46 79
50 100
53 67
54 63
56 98
57 81
61 69
65 68
66 91
70 122
71 86
73 101
74 94
75 85
78...

result:

ok ok (1000 test cases)

Test #25:

score: 0
Accepted
time: 71ms
memory: 8024kb

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
1 121
2 48
3 77
4 61
5 152
6 29
7 105
8 106
9 44
10 137
11 58
12 124
13 74
14 30
15 143
16 65
17 158
18 80
19 156
20 92
21 110
22 53
23 161
24 120
25 115
26 84
27 100
28 31
32 135
33 132
34 86
35 83
36 127
37 148
38 62
39 46
40 165
41 99
42 94
43 163
45 111
47 71
49 64
50 122
51 159
52 149
54 88
...

result:

ok ok (1000 test cases)

Test #26:

score: 0
Accepted
time: 48ms
memory: 9820kb

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

result:

ok ok (1000 test cases)

Test #27:

score: 0
Accepted
time: 58ms
memory: 7764kb

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
1 283
2 495
3 541
4 712
5 35
6 780
7 658
8 434
9 471
10 404
11 86
12 388
13 287
14 290
15 32
16 387
17 673
18 150
19 289
20 242
21 25
22 871
23 241
24 458
26 507
27 467
28 36
29 219
30 859
31 452
33 328
34 571
37 905
38 183
39 432
40 42
41 58
43 888
44 488
45 93
46 216
47 246
48 145
49 52
50 55
...

result:

ok ok (1000 test cases)

Test #28:

score: 0
Accepted
time: 50ms
memory: 10016kb

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
1 12
2 394
3 420
4 6
5 458
7 8
9 418
10 403
11 166
13 121
14 283
15 19
16 91
17 82
18 256
20 22
21 78
23 28
24 25
26 30
27 334
29 33
31 469
32 380
34 222
35 367
36 509
37 385
38 201
39 70
40 225
41 46
42 301
43 44
45 415
47 100
48 49
50 52
51 55
53 156
54 507
56 57
58 61
59 416
60 502
62 96
63 6...

result:

ok ok (1000 test cases)

Test #29:

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

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

result:

ok ok (1000 test cases)

Test #30:

score: 0
Accepted
time: 55ms
memory: 9756kb

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
1 116
2 3
4 82
5 18
6 40
7 155
8 56
9 10
11 161
12 59
13 15
14 17
16 150
19 23
20 126
21 90
22 138
24 85
25 144
26 29
27 55
28 157
30 119
31 133
32 148
33 38
34 36
35 37
39 86
41 109
42 43
44 93
45 46
47 61
48 51
49 97
50 76
52 153
53 108
54 62
57 131
58 106
60 135
63 105
64 121
65 66
67 154
68 6...

result:

ok ok (1000 test cases)

Test #31:

score: 0
Accepted
time: 59ms
memory: 9756kb

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
1 4
2 423
3 45
5 343
6 107
7 257
8 287
9 470
10 17
11 205
12 279
13 167
14 83
15 20
16 280
18 30
19 208
21 219
22 248
23 468
24 143
25 29
26 163
27 124
28 84
31 86
32 344
33 389
34 407
35 97
36 282
37 310
38 268
39 135
40 41
42 115
43 211
44 57
46 90
47 283
48 54
49 216
50 384
51 272
52 88
53 24...

result:

ok ok (1000 test cases)

Test #32:

score: 0
Accepted
time: 58ms
memory: 9716kb

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
1 29
2 8
3 38
4 13
5 34
6 37
7 31
9 33
10 42
11 17
12 20
14 23
15 16
18 39
19 24
21 30
22 35
25 32
26 28
27 41
36 40
37
1 11
2 37
3 53
4 36
5 65
6 58
7 17
8 15
9 44
10 64
12 33
13 69
14 40
16 54
18 62
19 63
20 73
21 30
22 72
23 35
24 42
25 26
27 74
28 57
29 51
31 47
32 71
34 60
38 55
39 70
41 67
...

result:

ok ok (1000 test cases)

Test #33:

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

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
1 4
2 7
3 124
5 109
6 9
8 105
10 46
11 119
12 90
13 51
14 26
15 50
16 76
17 23
18 103
19 106
20 47
21 81
22 118
24 57
25 27
28 99
29 61
30 52
31 92
32 117
33 160
34 49
35 86
36 154
37 128
38 70
39 75
40 68
41 93
42 162
43 60
44 127
45 62
48 108
53 132
54 146
55 91
56 152
58 133
59 141
63 125
64 1...

result:

ok ok (1000 test cases)

Test #34:

score: 0
Accepted
time: 77ms
memory: 11900kb

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: 78ms
memory: 7928kb

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
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 #36:

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

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: 80ms
memory: 12120kb

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
1 1185
2 3704
3 2184
4 3332
5 2607
6 7
8 492
9 3655
11 3648
12 2218
13 3779
14 188
15 3422
10 16
17 18
20 1379
21 2633
22 344
23 2041
19 24
25 26
28 2495
27 29
30 291
31 1801
33 5543
32 34
35 800
36 4795
37 4007
38 1599
39 2180
40 1795
41 4421
43 2444
42 44
45 3910
46 5229
48 4205
49 3710
50 42...

result:

ok ok (100 test cases)

Test #38:

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

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
1 1836
2 521
3 1290
4 178
5 895
6 791
7 205
8 1110
9 624
10 1481
11 550
12 38
13 584
14 20
15 1359
16 798
17 176
18 389
19 1992
21 1581
22 792
23 1069
24 1580
25 1710
26 1834
27 1760
28 621
29 207
30 725
31 1746
32 1219
33 1024
34 537
35 1566
36 380
37 989
39 1167
40 1104
41 1602
42 307
44 1590
...

result:

ok ok (100 test cases)

Test #39:

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

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
1 16
2 321
3 343
4 201
5 136
6 12
7 342
8 176
9 328
10 36
11 30
13 46
14 117
15 337
17 53
18 346
19 31
20 22
21 45
23 340
24 71
25 50
26 329
27 85
28 65
29 282
32 33
34 76
35 41
37 43
38 61
39 47
40 67
42 49
44 195
48 68
51 79
52 55
54 307
56 149
57 83
58 66
59 60
62 148
63 319
64 123
69 96
70 9...

result:

ok ok (100 test cases)

Test #40:

score: 0
Accepted
time: 72ms
memory: 8116kb

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
1 637
2 194
3 585
4 714
5 414
6 299
7 124
8 20
9 81
10 118
11 569
12 69
13 489
14 231
15 219
16 804
17 90
18 182
19 64
21 750
22 563
23 42
24 164
25 117
26 86
27 200
28 439
29 821
30 110
31 691
32 839
33 210
34 294
35 630
36 214
37 206
38 445
39 433
40 244
41 115
43 586
44 276
45 180
46 741
47 2...

result:

ok ok (100 test cases)

Test #41:

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

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
1 251
2 240
3 16
4 60
5 218
6 183
7 151
8 124
9 72
10 189
11 157
12 194
13 278
14 27
15 47
17 63
18 266
19 115
20 267
21 277
22 181
23 129
24 125
25 44
26 105
28 100
29 59
30 34
31 134
32 74
33 122
35 156
36 177
37 97
38 204
39 130
40 226
41 238
42 65
43 107
45 62
46 139
48 99
49 187
50 261
51 1...

result:

ok ok (100 test cases)

Test #42:

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

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
1 86
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
87 88
89 90
91 92
93 94
95 96
97 98
99 100
101 ...

result:

ok ok (100 test cases)

Test #43:

score: 0
Accepted
time: 59ms
memory: 7868kb

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
1 8
2 1626
3 7
4 3099
5 1668
6 1054
9 11
10 1417
12 3115
13 233
14 2865
15 18
16 1188
17 20
19 22
21 3222
23 27
24 125
25 366
26 84
28 2404
29 3163
30 1278
31 2141
32 33
34 2054
35 413
36 38
37 39
40 3264
41 2411
42 466
43 3177
44 46
45 51
47 2235
48 1023
49 50
52 613
53 55
54 59
56 2527
57 58
...

result:

ok ok (100 test cases)

Test #44:

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

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
1 860
2 754
3 114
4 728
5 71
6 141
7 827
8 718
9 188
10 641
11 27
12 269
13 225
14 432
15 423
16 33
17 506
18 22
19 628
20 36
21 406
23 26
24 280
25 584
28 783
29 68
30 48
31 605
32 39
34 35
37 41
38 294
40 53
42 614
43 131
44 275
45 470
46 842
47 548
49 702
50 710
51 918
52 925
54 701
55 481
56...

result:

ok ok (100 test cases)

Test #45:

score: 0
Accepted
time: 58ms
memory: 9892kb

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

result:

ok ok (100 test cases)

Test #46:

score: 0
Accepted
time: 59ms
memory: 7988kb

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
1 3485
2 2042
3 1472
4 4187
5 8
6 229
7 1777
9 12
10 14
11 770
13 1505
15 1005
16 17
18 27
19 4208
20 2914
21 25
22 4106
23 1192
24 326
26 2501
28 38
29 3865
30 402
31 33
32 2853
34 3070
35 39
36 4518
37 4158
40 1076
41 3817
42 43
44 54
45 2308
46 302
47 48
49 4123
50 3323
51 1183
52 2724
53 31...

result:

ok ok (100 test cases)

Test #47:

score: 0
Accepted
time: 59ms
memory: 9912kb

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
1 351
2 509
3 773
4 12
5 179
6 219
7 261
8 158
9 232
10 384
11 27
13 741
14 206
15 76
16 61
17 586
18 349
19 104
20 67
21 34
22 496
23 679
24 156
25 706
26 357
28 643
29 342
30 99
31 63
32 392
33 199
35 41
36 493
37 182
38 362
39 619
40 552
42 491
43 551
44 89
45 647
46 321
47 94
48 356
49 348
5...

result:

ok ok (100 test cases)

Test #48:

score: 0
Accepted
time: 63ms
memory: 8004kb

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
1 1122
2 1304
3 342
4 48
5 1614
6 1051
7 4446
8 44
9 689
10 307
11 3037
12 1046
13 2918
14 1789
15 3175
16 1353
17 4106
18 92
19 597
20 1222
21 1776
22 336
23 1143
24 1939
25 1896
26 357
27 4225
28 1038
29 4327
30 511
31 54
32 1746
33 50
34 3664
35 836
36 1623
37 4462
38 3977
39 508
40 1544
41 ...

result:

ok ok (100 test cases)

Test #49:

score: 0
Accepted
time: 68ms
memory: 7908kb

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
1 9
2 162
3 104
4 41
5 226
6 15
7 130
8 74
10 175
11 156
12 27
13 159
14 151
16 97
17 22
18 191
19 78
20 73
21 81
23 152
24 166
25 32
26 60
28 88
29 44
30 56
31 79
33 82
34 59
35 160
36 71
37 182
38 52
39 225
40 100
42 65
43 84
45 204
46 186
47 98
48 102
49 207
50 213
51 196
53 58
54 69
55 111
5...

result:

ok ok (100 test cases)

Test #50:

score: 0
Accepted
time: 90ms
memory: 9144kb

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: 92ms
memory: 12668kb

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
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 #52:

score: 0
Accepted
time: 88ms
memory: 12312kb

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
1 2
4 27113
5 28786
3 6
7 9927
9 8081
8 10
11 11290
12 5876
13 15254
14 15
16 17
18 1462
19 20
21 6507
23 9346
22 24
25 3278
26 6461
28 1198
27 29
30 3059
32 28159
31 33
34 35
36 37
38 10208
40 710
41 7797
42 4572
39 43
44 45
46 15749
47 48
49 50
51 14302
52 11061
53 27790
55 8339
54 56
58 1977...

result:

ok ok (10 test cases)

Test #53:

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

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
1 1467
2 7308
3 5101
4 7431
5 13052
6 11704
7 8
9 730
10 2064
11 7019
12 10638
13 8236
14 6815
15 8300
16 11198
17 3975
18 12326
19 5128
20 1402
21 838
22 12902
23 280
24 7643
25 6031
26 27
28 4179
29 4974
30 72
31 580
32 10528
33 5620
35 10873
36 10729
37 912
38 2584
39 10692
40 6835
34 41
43 ...

result:

ok ok (10 test cases)

Test #54:

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

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
1 35652
2 1093
3 34671
4 272
5 33979
6 32990
7 1027
8 33802
9 30944
10 2225
11 2691
12 1772
13 37077
14 1548
15 37555
16 33349
17 664
18 221
19 34181
20 32918
21 34721
22 585
23 345
24 35119
25 574
26 38783
27 45
28 681
29 37394
30 8511
31 2115
32 37382
33 35901
34 1297
35 38240
36 1688
37 248...

result:

ok ok (10 test cases)

Test #55:

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

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
1 29702
2 29149
3 140
4 395
5 328
6 379
7 98
8 129
9 26274
10 29063
11 29211
12 184
13 353
14 29621
15 29857
16 28320
17 29862
18 29607
19 560
20 78
21 29476
22 152
23 478
24 26888
25 29695
26 29700
27 289
28 40
29 143
30 29818
31 29838
32 29850
33 60
34 27637
35 228
36 52
37 26179
38 1773
39 ...

result:

ok ok (10 test cases)

Test #56:

score: 0
Accepted
time: 71ms
memory: 10644kb

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
1 36499
2 2610
3 3902
4 967
5 33158
6 9767
7 181
8 10696
9 1070
10 35637
11 1857
12 327
13 9136
14 1385
15 3555
16 216
17 583
18 34739
19 36453
20 2664
21 208
22 138
23 923
24 33927
25 402
26 29350
27 35789
28 1449
29 30309
30 34510
31 31666
32 35339
33 881
34 24221
35 515
36 35326
37 34813
38...

result:

ok ok (10 test cases)

Test #57:

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

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
1 295
2 13
3 219
4 423
5 75
6 116
7 568
8 388
9 127
10 431
11 603
12 270
14 670
15 18
16 273
17 52
19 21
20 406
22 424
23 151
24 664
25 774
26 666
27 28
29 482
30 607
31 35
32 91
33 333
34 253
36 39
37 186
38 269
40 50
41 550
42 168
43 141
44 361
45 595
46 164
47 653
48 414
49 298
51 638
53 539
...

result:

ok ok (10 test cases)

Test #58:

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

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
1 309
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...

result:

ok ok (10 test cases)

Test #59:

score: 0
Accepted
time: 71ms
memory: 11420kb

input:

10
5000
-188767223 -315528788
-987365245 -315528788
-106387689 135511984
127392808 -315528788
800721151 -315528788
146952905 -315528788
-323702728 135511984
411611172 135511984
872064533 -315528788
-40050336 135511984
119702024 135511984
-208480603 -315528788
679048782 -315528788
402900711 -31552878...

output:

5000
1 691
2 9884
3 22
4 6557
5 8182
6 12
7 3727
8 5884
9 8233
10 4275
11 5954
13 4385
14 6909
15 6005
16 2758
17 136
18 3353
19 31
20 5360
21 7177
23 796
24 5088
25 9314
26 5648
27 139
28 8232
29 3667
30 1284
32 1049
33 1031
34 47
35 4245
36 39
37 1850
38 1515
40 4775
41 5937
42 51
43 7872
44 6193
...

result:

ok ok (10 test cases)

Test #60:

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

input:

10
5892
25327490 -567979409
-735380777 -567979409
362509197 -518667355
380762791 -518667355
-325207607 -518667355
541910006 -518667355
36310841 -567979409
-726943590 -518667355
513235902 -518667355
289283655 -518667355
290421813 -567979409
892523351 -567979409
-894087744 -567979409
621832318 -567979...

output:

5892
1 7407
2 11
3 2548
4 8005
5 1044
6 8044
7 2821
8 10976
9 10095
10 4482
12 4804
13 11638
14 15
16 20
17 1176
18 7202
19 5415
21 26
22 11452
23 11148
24 7185
25 3987
27 2822
28 1228
29 1188
30 1473
31 420
32 35
33 2040
34 10206
36 40
37 43
38 6144
39 8508
41 8413
42 3704
44 11023
45 272
46 50
47 ...

result:

ok ok (10 test cases)

Test #61:

score: 0
Accepted
time: 60ms
memory: 12804kb

input:

10
7074
241731848 530211859
241731848 -112101076
241731848 -387299272
241731848 840407166
241731848 -519364921
241731848 -927667636
241731848 -12750799
241731848 446782229
241731848 -605995785
241731848 -360804301
241731848 -706630766
241731848 95158934
241731848 -937680624
241731848 162324777
24173...

output:

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

result:

ok ok (10 test cases)

Test #62:

score: 0
Accepted
time: 67ms
memory: 12904kb

input:

10
729
867500722 -983664796
867500722 -428285695
-323742684 -171458916
-323742684 440597108
867500722 878319625
867500722 225023835
-323742684 -291982426
-323742684 568294497
867500722 327920686
867500722 -477580489
-323742684 310693081
-323742684 775098797
867500722 -334572408
-323742684 181766129
...

output:

729
1 1098
2 1036
3 730
4 854
5 542
6 20
7 87
8 274
9 268
10 1043
11 653
12 1346
13 30
14 56
15 1353
16 1046
17 110
18 1390
19 326
21 54
22 864
23 259
24 304
25 1328
26 567
27 875
28 1363
29 1377
31 1384
32 824
33 786
34 897
35 978
36 173
37 895
38 962
39 240
40 286
41 1172
42 119
43 1343
44 1332
45...

result:

ok ok (10 test cases)

Test #63:

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

input:

10
23890
-966926807 -783294985
-966926807 -231086723
-966926807 -827425532
-966926807 951590873
-966926807 -847083727
-322954521 -903547355
-966926807 395823002
-322954521 113620163
-966926807 442076584
-322954521 -358356830
-966926807 -416611206
-966926807 308206261
-322954521 -548371038
-966926807...

output:

23890
1 12852
2 3
4 40230
5 13888
6 44018
7 24812
8 20642
9 14
10 20588
11 14274
12 12321
13 15
16 14216
17 30826
18 7766
19 7181
20 13433
21 31740
22 35117
23 32364
24 44544
25 15106
26 31
27 15007
28 42463
29 12062
30 40303
32 16442
33 44
34 7377
35 18344
36 24370
37 22499
38 22922
39 44229
40 396...

result:

ok ok (10 test cases)

Test #64:

score: 0
Accepted
time: 68ms
memory: 10936kb

input:

10
6461
164403694 719871079
-178686855 -505252945
820168812 419207217
-229478200 77799158
677361796 77799158
575661006 419207217
-697613489 -329650846
-362539459 -563403377
727778010 -563403377
-111787135 419207217
892586613 -329650846
664142990 435882783
-746057528 435882783
-484808272 -329650846
-...

output:

6461
1 282
2 6928
3 4518
4 10863
5 487
6 1016
7 11269
8 6245
9 10065
10 8693
11 7093
12 6825
13 3191
14 7374
15 12572
16 2825
17 7124
18 320
19 11230
20 5597
21 5770
22 7207
23 8922
24 11928
25 4464
26 7859
27 10991
28 5445
29 4023
30 2019
31 1824
32 93
33 34
35 10080
36 163
37 72
38 84
39 3888
40 3...

result:

ok ok (10 test cases)

Test #65:

score: 0
Accepted
time: 71ms
memory: 10668kb

input:

10
14956
895706895 998300226
820538240 306140296
-445632195 597312604
-409959410 597312604
755346555 251251450
259123019 -176732314
701825202 -694016428
520061157 306140296
626248236 -236060915
321824154 -762678310
714689875 444441588
-774797456 597312604
4205823 306140296
104689711 -236060915
-9484...

output:

14956
1 24120
2 8953
3 13021
4 20363
5 723
6 13034
7 9401
8 25434
9 9000
10 4301
11 27256
12 9268
13 14826
14 24555
15 914
16 19423
17 6401
18 12430
19 512
20 2609
21 25249
22 2392
23 2864
24 26429
25 36
26 8884
27 5628
28 20423
29 19776
30 478
31 6194
32 6577
33 5240
34 26184
35 15705
37 10123
38 3...

result:

ok ok (10 test cases)

Test #66:

score: -100
Wrong Answer
time: 108ms
memory: 13944kb

input:

1
100000
70720045 -382955525
180416482 414551370
-321808609 -148240525
-959621209 239890090
279590168 239445206
-672414454 -968764851
978907902 855176899
-927586531 -493246847
-87140549 -239161862
394302217 -390243883
747094712 472952985
437187652 834551586
-394349288 431373156
954522299 545636033
-...

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:

wrong answer worse than author's solution: expected 23, found 0 (test case 1)