QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#369207#7791. 通道建设 Passage Constructionzhouhuanyi90.192415 999ms7744kbC++232.3kb2024-03-27 21:56:482024-03-27 21:56:48

Judging History

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

  • [2024-03-27 21:56:48]
  • 评测
  • 测评结果:90.192415
  • 用时:999ms
  • 内存:7744kb
  • [2024-03-27 21:56:48]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include"passageconstruction.h"
#define SN 10000
using namespace std;
const int inf=(int)(1e9);
int n,rt,smz,minn,ps[SN+1],depth[SN+1],sz[SN+1];
bool vis[SN+1],vst[SN+1];
vector<int>E[SN+1];
vector<int>p[SN+1];
vector<int>tans;
vector<pair<int,int> >ans;
void add(int x,int y)
{
	E[x].push_back(y),E[y].push_back(x);
	return;
}
void dfs(int x)
{
	for (int i=0;i<E[x].size();++i)
	{
		dfs(E[x][i]);
		if (ps[x]&&ps[E[x][i]]) ans.push_back(make_pair(ps[x],ps[E[x][i]])),ps[x]=0;
		else ps[x]^=ps[E[x][i]];
	}
	if (ps[x]) ans.push_back(make_pair(ps[x],x)),ps[x]=0;
	else ps[x]=x;
	return;
}
void dfs2(int x)
{
	vector<int>st;
	int res=vis[x];
	sz[x]=vis[x];
	for (int i=0;i<E[x].size();++i)
	{
		dfs2(E[x][i]),sz[x]+=sz[E[x][i]],st.push_back(E[x][i]);
		if (sz[x]>1&&max(sz[x],smz-sz[x])<minn) rt=x,minn=max(sz[x],smz-sz[x]),tans=st;
	}
	st.clear();
	for (int i=E[x].size()-1;i>=0;--i)
	{
		st.push_back(E[x][i]),res+=sz[E[x][i]];
		if (res>1&&max(res,smz-res)<minn) rt=x,minn=max(res,smz-res),tans=st;
	}
	return;
}
void dfs3(int x)
{
	if (vis[x]) vst[x]=1;
	for (int i=0;i<E[x].size();++i) dfs3(E[x][i]);
	return;
}
void solve(vector<int>A,vector<int>B)
{
	if (B.empty()) return;
	if (A.size()==1)
	{
		for (int i=0;i<B.size();++i) E[A[0]].push_back(B[i]);
		return;
	}
	if (A.size()==2)
	{
		for (int i=0;i<B.size();++i)
		{
			if (QueryLCA({B[i]},{A[0],A[1]},A[0])[0]) E[A[0]].push_back(B[i]);
			else E[A[1]].push_back(B[i]);
		}
		return;
	}
	minn=inf,rt=0,tans.clear();
	for (int i=0;i<A.size();++i) vis[A[i]]=1;
	smz=A.size(),dfs2(1);
	vector<int>v1;
	vector<int>v2;
	vector<int>s1;
	vector<int>s2;
	for (int i=0;i<tans.size();++i) dfs3(tans[i]);
	for (int i=0;i<A.size();++i)
	{
		if (vst[A[i]]) v1.push_back(A[i]);
		else v2.push_back(A[i]);
	}
	for (int i=0;i<A.size();++i) vis[A[i]]=vst[A[i]]=0;
	vector<int>v=QueryLCA(B,v1,rt);
	for (int i=0;i<v.size();++i)
	{
		if (!v[i]) s1.push_back(B[i]);
		else s2.push_back(B[i]);
	}
	solve(v1,s1),solve(v2,s2);
	return;
}
std::vector<std::pair<int,int>>ConstructPassages(int N, const std::vector<std::pair<int,int>>&E)
{
	n=N;
	int res=0;
	for (int i=1;i<=(n<<1);++i) depth[i]=GetDistance(1,i),p[depth[i]].push_back(i),res=max(res,depth[i]);
	for (int i=1;i<=res;++i) solve(p[i-1],p[i]);
	dfs(1);
	return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 1ms
memory: 3668kb

input:

1
1872884041
100 100 10000 10000
1
2294931821 2294931820

output:

Succeeded
0 2 0 0
2 1

result:

ok Accepted with 0+2 operations,sum of size(s)=0+0

Test #2:

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

input:

1
1977600624
100 100 10000 10000
5
621522394 621522399
2231003352 2231003338
464307841 464307837
1851407771 1851407768
2780336863 2780336849
314073909 314073902
1173467454 1173467430
4215033871 4215033843
2620057116 2620057098

output:

Succeeded
8 10 12 16
4 7
2 6
8 3
9 5
10 1

result:

ok Accepted with 8+10 operations,sum of size(s)=12+16

Test #3:

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

input:

1
1314992723
100 100 10000 10000
2
1174248192 1174248188
4206147071 4206147069
2894997654 2894997645

output:

Succeeded
0 4 0 0
4 2
3 1

result:

ok Accepted with 0+4 operations,sum of size(s)=0+0

Test #4:

score: 3
Accepted
time: 1ms
memory: 3904kb

input:

1
1466488642
100 100 10000 10000
3
1959342134 1959342129
3976386946 3976386946
1293201451 1293201449
4016912388 4016912383
46728190 46728181

output:

Succeeded
1 6 1 2
3 2
4 6
5 1

result:

ok Accepted with 1+6 operations,sum of size(s)=1+2

Test #5:

score: 3
Accepted
time: 1ms
memory: 3696kb

input:

1
1733551538
100 100 10000 10000
4
4255320958 4255320951
1233889267 1233889267
2022156010 2022156014
1746602236 1746602223
1796304111 1796304099
154520793 154520786
799267407 799267389

output:

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

result:

ok Accepted with 3+8 operations,sum of size(s)=3+6

Test #6:

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

input:

1
1103590331
100 100 10000 10000
4
3735090189 3735090176
179620503 179620501
1550955883 1550955882
3533004575 3533004552
2159969243 2159969227
2549716219 2549716202
1755562372 1755562356

output:

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

result:

ok Accepted with 3+8 operations,sum of size(s)=3+6

Test #7:

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

input:

1
1007922703
100 100 10000 10000
5
3347355425 3347355424
924935451 924935434
3554593528 3554593525
2830078883 2830078872
3185621515 3185621508
32902500 32902483
1057526055 1057526035
3737430162 3737430144
106424402 106424399

output:

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

result:

ok Accepted with 5+10 operations,sum of size(s)=7+11

Test #8:

score: 3
Accepted
time: 1ms
memory: 3952kb

input:

1
1401446296
100 100 10000 10000
5
4125806477 4125806476
1224445301 1224445291
1474144594 1474144597
2898586557 2898586536
879608888 879608877
3110900945 3110900930
2490037068 2490037051
422424582 422424570
1017432306 1017432295

output:

Succeeded
8 10 12 16
7 10
3 5
8 9
2 4
6 1

result:

ok Accepted with 8+10 operations,sum of size(s)=12+16

Test #9:

score: 3
Accepted
time: 1ms
memory: 3724kb

input:

1
1756894897
100 100 10000 10000
5
2081532117 2081532115
4275738287 4275738273
632146529 632146534
2424607270 2424607263
2157363450 2157363443
2463928559 2463928550
3381117807 3381117785
4186361975 4186361960
3382018566 3382018532

output:

Succeeded
6 10 6 12
7 9
8 5
10 6
3 2
4 1

result:

ok Accepted with 6+10 operations,sum of size(s)=6+12

Test #10:

score: 3
Accepted
time: 1ms
memory: 3724kb

input:

1
1465320926
100 100 10000 10000
5
2695813796 2695813789
3049323317 3049323309
231883125 231883119
3073242409 3073242392
1388430756 1388430755
183732731 183732729
1423324287 1423324267
3470698806 3470698795
354321542 354321525

output:

Succeeded
6 10 7 12
6 2
9 3
7 10
4 8
5 1

result:

ok Accepted with 6+10 operations,sum of size(s)=7+12

Subtask #2:

score: 6
Accepted

Test #11:

score: 6
Accepted
time: 1ms
memory: 4020kb

input:

2
755640766
20000 10000 200000 200000
100
4287951944 4287951892
218593589 218593610
2907028702 2907028595
100123056 100122959
3149201405 3149201229
3454414687 3454414608
1901257489 1901257490
1532337798 1532337686
836222214 836222227
187381584 187381446
1847826999 1847827071
2868544732 2868544653
41...

output:

Succeeded
258 200 813 653
71 13
76 20
57 163
170 18
16 2
127 174
9 60
28 45
88 58
133 17
29 82
27 59
64 122
41 47
37 54
62 131
93 90
44 114
85 134
124 150
158 166
116 22
14 119
142 87
69 46
56 99
15 42
193 8
195 19
61 78
164 95
32 77
98 182
50 49
180 91
181 115
25 189
5 194
51 84
172 143
185 160
159...

result:

ok Accepted with 258+200 operations,sum of size(s)=813+653

Test #12:

score: 6
Accepted
time: 1ms
memory: 3724kb

input:

2
587237803
20000 10000 200000 200000
98
217447661 217447616
2463641363 2463641406
3373538248 3373538212
3950835015 3950834997
2221322822 2221322872
146298284 146298141
531452967 531453049
3941453926 3941454046
3084946195 3084946149
1270490559 1270490368
1019372524 1019372347
2754251578 2754251434
5...

output:

Succeeded
268 196 898 717
90 192
112 108
44 64
29 117
31 116
80 147
26 194
163 32
4 171
18 62
30 73
40 187
81 121
2 98
111 169
145 176
10 56
57 48
71 47
22 51
131 127
93 182
161 104
85 19
102 190
83 189
59 100
76 109
20 188
7 79
35 54
77 125
9 75
158 152
135 58
132 183
142 67
21 118
24 134
155 164
1...

result:

ok Accepted with 268+196 operations,sum of size(s)=898+717

Test #13:

score: 6
Accepted
time: 1ms
memory: 3972kb

input:

2
184226984
20000 10000 200000 200000
99
547000384 547000355
872110096 872110116
1289538184 1289538247
3616724666 3616724569
636341527 636341600
2563522202 2563522274
2177548205 2177548137
3089489449 3089489506
3156380759 3156380856
944465184 944465231
823584265 823584499
333051247 333051023
1754238...

output:

Succeeded
251 198 854 657
73 121
74 17
180 48
35 49
195 116
148 161
51 168
16 92
26 98
56 136
190 21
43 94
6 54
153 152
112 107
111 162
101 125
193 196
123 173
104 149
81 71
103 144
170 169
65 91
176 177
75 108
110 52
102 174
194 70
120 124
166 160
155 159
105 109
106 142
146 189
158 57
178 150
46 1...

result:

ok Accepted with 251+198 operations,sum of size(s)=854+657

Test #14:

score: 6
Accepted
time: 1ms
memory: 3768kb

input:

2
1727138930
20000 10000 200000 200000
99
3247483138 3247483162
4084597375 4084597429
2636905019 2636904971
946660642 946660700
902149328 902149350
2382255766 2382255865
839303047 839303137
1923325547 1923325538
653690681 653690724
4175318562 4175318731
3824454449 3824454478
2650316775 2650316587
58...

output:

Succeeded
249 198 839 653
56 103
101 102
161 120
111 182
133 134
117 112
105 118
132 140
109 119
125 145
178 30
194 22
92 108
153 77
6 36
17 177
27 196
59 72
32 80
184 5
137 139
51 149
126 162
3 195
73 78
35 15
26 113
129 160
39 60
53 57
151 189
146 82
148 180
47 21
29 71
8 90
198 88
79 116
34 98
11...

result:

ok Accepted with 249+198 operations,sum of size(s)=839+653

Test #15:

score: 6
Accepted
time: 2ms
memory: 4020kb

input:

2
1220143324
20000 10000 200000 200000
100
693596313 693596332
62576744 62576808
1955936424 1955936264
3872655610 3872655531
1013531683 1013531829
2985331208 2985331369
2406362516 2406362582
1657349556 1657349602
1003910904 1003910721
1096398841 1096398795
1778724026 1778723842
713692268 713692342
2...

output:

Succeeded
256 200 850 659
19 59
102 186
193 63
9 51
124 184
58 39
37 69
142 79
42 54
40 49
11 76
34 66
113 118
153 168
181 119
116 129
190 147
173 130
106 121
160 200
144 138
101 120
175 136
140 164
189 91
185 137
22 155
126 158
183 187
115 146
125 166
103 198
105 143
191 18
57 117
35 12
55 156
27 4...

result:

ok Accepted with 256+200 operations,sum of size(s)=850+659

Test #16:

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

input:

2
442130601
20000 10000 200000 200000
100
3144169521 3144169542
3602466736 3602466791
26223369 26223537
866636824 866636802
1192888944 1192888905
2768179340 2768179316
992350648 992350588
1606144049 1606144118
2825460299 2825460268
2783910130 2783910118
403964521 403964517
445570315 445570360
126026...

output:

Succeeded
257 200 824 669
8 38
94 105
134 160
76 152
147 52
132 149
156 17
45 82
200 11
36 131
140 91
117 130
183 115
41 100
18 54
133 194
56 158
168 26
198 107
199 159
145 127
114 167
150 182
195 10
179 110
174 120
124 184
42 88
58 68
137 95
74 22
3 29
196 87
27 104
39 62
176 57
19 31
192 154
64 49...

result:

ok Accepted with 257+200 operations,sum of size(s)=824+669

Test #17:

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

input:

2
949343282
20000 10000 200000 200000
97
1170242583 1170242801
4247921283 4247921322
1529679099 1529679065
1051858814 1051858774
3893889966 3893889994
3958531511 3958531352
2502650796 2502650862
813064156 813064047
1048780624 1048780414
3993902928 3993902731
803344004 803343802
3547336751 3547336794...

output:

Succeeded
253 194 839 661
62 49
44 91
58 123
159 82
48 125
25 153
184 57
122 31
10 176
30 39
98 54
40 135
72 43
182 28
63 75
29 117
97 115
183 142
85 179
16 144
101 73
148 76
112 138
79 189
77 87
17 127
21 18
99 32
94 145
109 36
9 96
132 136
141 46
100 155
118 165
160 193
174 45
88 164
102 163
111 1...

result:

ok Accepted with 253+194 operations,sum of size(s)=839+661

Test #18:

score: 6
Accepted
time: 1ms
memory: 3768kb

input:

2
734508634
20000 10000 200000 200000
98
213911368 213911499
2488548419 2488548499
516780967 516780705
3349442602 3349442765
857297035 857297029
1348690665 1348690579
1548954171 1548954133
3605026599 3605026727
182470368 182470292
1455323224 1455323364
2179991017 2179991001
3209649930 3209649949
145...

output:

Succeeded
257 196 817 662
130 44
24 49
20 136
146 10
102 135
60 117
30 147
76 111
141 142
7 148
97 17
103 129
19 11
25 28
121 84
18 50
87 176
78 55
159 4
2 31
23 83
112 64
5 33
158 144
9 77
16 93
184 152
194 12
63 171
172 26
101 186
92 95
110 119
175 75
157 100
21 36
185 190
14 67
81 89
8 39
6 51
56...

result:

ok Accepted with 257+196 operations,sum of size(s)=817+662

Subtask #3:

score: 8
Accepted

Test #19:

score: 8
Accepted
time: 2ms
memory: 4620kb

input:

3
397960972
100000 4000 200000 200000
1000
3136131587 3136131078
3887641427 3887642253
280951546 280951198
124187343 124186744
3948118891 3948118785
2174920490 2174920140
3041102338 3041103477
489656932 489656480
3093689453 3093690199
3027233105 3027233261
967551350 967551424
215138938 215138436
251...

output:

Succeeded
1087 2000 1087 2174
1855 1366
1563 1773
1275 1969
1313 1368
1409 1107
1727 1643
1837 1134
1600 1844
1114 1677
1937 1610
1588 1122
1298 1630
1755 1829
1178 1561
1357 1852
1394 1347
1054 1751
1887 1806
1266 1164
1579 1868
1609 1824
1276 1613
1078 1697
1866 1272
1554 1009
1223 1477
1214 1462
...

result:

ok Accepted with 1087+2000 operations,sum of size(s)=1087+2174

Test #20:

score: 8
Accepted
time: 0ms
memory: 4724kb

input:

3
755523510
100000 4000 200000 200000
999
837610461 837610217
209552123 209552158
2202987134 2202987346
3933843218 3933843131
2783546817 2783547323
415275024 415276142
13876082 13876176
448702939 448703028
1294393612 1294394136
3910397405 3910397094
3416630484 3416630700
3215888394 3215888948
124509...

output:

Succeeded
111 1998 111 222
728 346
13 1690
49 468
103 745
485 897
149 86
913 82
826 735
750 408
41 83
365 202
414 124
1200 301
843 283
77 694
266 156
840 789
1764 767
938 878
618 959
1564 90
20 249
51 275
994 396
1144 585
429 732
85 692
665 234
380 739
969 1630
626 449
132 884
583 558
660 1634
505 3...

result:

ok Accepted with 111+1998 operations,sum of size(s)=111+222

Test #21:

score: 8
Accepted
time: 2ms
memory: 4400kb

input:

3
2042812129
100000 4000 200000 200000
998
3075748308 3075748844
1569673104 1569672823
3968525693 3968524672
2108387096 2108386924
3356390455 3356391094
3372812724 3372813320
3904961007 3904958854
4029621824 4029621345
4114486509 4114486281
1387138301 1387138067
124292409 124292880
3935517019 393551...

output:

Succeeded
1407 1996 1407 2814
1325 1749
1702 1332
1114 1225
1984 1397
1723 1307
1737 1658
1495 1813
1051 1838
1316 1067
1922 1696
1402 1946
1355 1363
1886 1208
1247 1539
1072 1505
1700 1624
1499 1436
1498 1268
1759 1326
1659 1857
1293 1920
1651 1242
1523 1311
1751 1687
1336 1347
1810 1021
1366 1147
...

result:

ok Accepted with 1407+1996 operations,sum of size(s)=1407+2814

Test #22:

score: 8
Accepted
time: 2ms
memory: 4648kb

input:

3
1597029305
100000 4000 200000 200000
998
2980500284 2980500361
2247716226 2247714887
988714926 988714253
1734063960 1734064121
2359409219 2359409008
411968449 411968499
155449826 155451318
555582797 555582911
45071917 45071590
1460631113 1460629818
3059213925 3059213709
2094519932 2094519250
38721...

output:

Succeeded
439 1996 439 878
1767 345
262 528
580 38
1719 910
1612 226
1391 1016
1557 719
431 130
1537 941
1894 322
1572 1024
1713 1082
1539 697
846 1712
1100 1898
293 1595
1970 1512
119 685
748 1521
282 245
551 419
1301 1688
857 774
488 1177
1854 1558
1950 1579
1136 576
1600 219
760 1643
167 887
1717...

result:

ok Accepted with 439+1996 operations,sum of size(s)=439+878

Test #23:

score: 8
Accepted
time: 2ms
memory: 4548kb

input:

3
1564467111
100000 4000 200000 200000
1000
1236547222 1236547523
2135786902 2135787064
2523622442 2523622714
1532839693 1532838477
818219113 818220033
676117995 676118414
570037547 570036834
514220702 514220842
3399494183 3399495268
2654728241 2654729498
1495037081 1495037412
2062047312 2062048382
...

output:

Succeeded
561 2000 561 1122
1367 1276
340 489
1496 602
783 21
1597 1715
994 1344
298 11
1693 1003
1737 643
709 268
552 237
1974 1391
1055 878
852 796
1345 371
209 1289
813 164
1840 1499
1960 1936
357 1188
137 1491
1488 873
279 537
724 151
1950 696
291 521
424 1920
1798 260
1166 711
1429 1638
53 280
...

result:

ok Accepted with 561+2000 operations,sum of size(s)=561+1122

Test #24:

score: 8
Accepted
time: 0ms
memory: 4380kb

input:

3
213138336
100000 4000 200000 200000
999
1130123143 1130122958
687694550 687694095
929485247 929484829
3680984473 3680983776
3074105335 3074104892
1342732123 1342731927
1364720805 1364720672
2077428724 2077428538
28510235 28511166
937776441 937776505
3414480885 3414480666
3148182306 3148181509
3485...

output:

Succeeded
839 1998 839 1678
837 581
427 276
84 423
90 646
277 760
687 28
530 444
5 895
21 141
497 458
564 381
237 27
271 465
293 231
808 524
79 104
301 755
596 482
390 998
147 498
351 951
283 580
754 246
60 884
647 412
402 398
817 1356
258 1915
363 645
138 662
967 953
379 324
543 567
492 494
961 556...

result:

ok Accepted with 839+1998 operations,sum of size(s)=839+1678

Test #25:

score: 8
Accepted
time: 0ms
memory: 4444kb

input:

3
924980045
100000 4000 200000 200000
998
1666991999 1666991279
148686690 148685590
324531768 324531788
2043725358 2043725640
1133184972 1133184631
853139746 853139683
1770837584 1770837761
1481554510 1481554714
1372084869 1372084950
1756084441 1756085236
2107756067 2107756010
3377586774 3377586312
...

output:

Succeeded
43 1996 43 86
702 874
78 412
551 608
661 662
1099 473
745 406
1850 447
28 481
746 714
411 511
738 317
949 582
825 1464
890 664
670 407
358 674
445 423
534 808
327 1963
549 360
878 219
851 860
623 665
419 533
1161 141
356 59
244 575
986 232
726 384
127 1373
915 364
806 353
654 463
785 333
7...

result:

ok Accepted with 43+1996 operations,sum of size(s)=43+86

Test #26:

score: 8
Accepted
time: 2ms
memory: 4340kb

input:

3
774146483
100000 4000 200000 200000
999
3478842381 3478843345
606332045 606332562
2701123033 2701123563
3216754910 3216755036
1217043418 1217043429
1501603802 1501603474
1778234551 1778234769
1444790432 1444791022
2502984240 2502984288
856947428 856947122
1363006586 1363006323
1995567044 199556642...

output:

Succeeded
1481 1998 1481 2962
233 436
55 112
711 125
874 394
419 462
171 1792
184 552
271 927
608 160
470 764
397 611
165 705
819 172
978 174
153 633
937 57
128 482
971 508
940 894
1740 34
835 314
720 261
868 801
322 751
816 628
1659 717
325 961
590 51
203 760
623 339
1905 9
120 447
181 375
880 575
...

result:

ok Accepted with 1481+1998 operations,sum of size(s)=1481+2962

Test #27:

score: 8
Accepted
time: 2ms
memory: 4568kb

input:

3
82266506
100000 4000 200000 200000
999
3056998601 3056998876
1887811910 1887812134
1616045105 1616045172
1784967209 1784967615
650919784 650918837
4290024152 4290024396
154133667 154133653
754913686 754913998
3014551042 3014550770
3332698384 3332698431
304657473 304657856
1466514044 1466515029
313...

output:

Succeeded
359 1998 359 718
569 426
125 954
850 1700
743 692
195 417
668 1125
962 971
563 270
865 421
655 285
772 989
525 467
317 348
412 122
1665 59
73 633
527 62
709 671
157 558
402 156
910 918
707 886
225 799
410 613
737 738
472 115
321 795
777 159
134 263
963 362
1175 388
985 166
409 301
407 193
...

result:

ok Accepted with 359+1998 operations,sum of size(s)=359+718

Test #28:

score: 8
Accepted
time: 2ms
memory: 4448kb

input:

3
1746021239
100000 4000 200000 200000
1000
3649747382 3649747015
3895797253 3895797184
4001365723 4001365122
564220364 564220085
362710516 362710456
2800243662 2800243024
2073687310 2073687797
145701776 145700951
492159209 492159366
3076148714 3076148148
1548738755 1548739322
3580263095 3580262700
...

output:

Succeeded
697 2000 697 1394
707 272
433 532
900 503
486 769
264 508
252 1196
108 696
656 874
924 755
1299 878
307 439
717 17
531 89
392 247
233 987
314 719
79 47
217 660
784 151
713 669
187 615
783 73
941 633
356 908
880 789
722 378
971 26
326 241
352 69
584 683
330 1202
1729 708
447 139
760 435
860...

result:

ok Accepted with 697+2000 operations,sum of size(s)=697+1394

Subtask #4:

score: 9
Accepted

Test #29:

score: 9
Accepted
time: 29ms
memory: 4464kb

input:

4
1084797752
100000 4000 200000 200000
1000
3456536122 3456534568
249115651 249115791
3576312078 3576312237
1880897416 1880895547
1944688480 1944688327
248846397 248847256
3567405828 3567405196
1084965392 1084965206
1435956247 1435955729
3887033767 3887032464
307260230 307260472
1476733874 147673312...

output:

Succeeded
2861 2000 13384 9333
1764 1936
1868 1009
1171 1354
1464 1367
1297 1114
745 1487
412 707
1053 1363
1798 1918
973 572
101 123
795 277
258 709
1530 104
1646 621
964 347
1458 1981
1739 1538
1130 1819
1011 896
508 230
1339 653
539 647
478 815
1493 775
884 344
1110 962
1568 849
71 669
59 518
117...

result:

ok Accepted with 2861+2000 operations,sum of size(s)=13384+9333

Test #30:

score: 9
Accepted
time: 36ms
memory: 4460kb

input:

4
583125216
100000 4000 200000 200000
1000
1729488108 1729488695
2234303914 2234304325
546617298 546616102
842050918 842051470
1951502077 1951501331
4271815110 4271815116
761587681 761586756
2172224244 2172223957
2934428060 2934428507
1919912734 1919912263
1067575137 1067574604
3411448089 3411447166...

output:

Succeeded
2791 2000 9301 7327
1532 1696
1693 1782
1584 1602
1153 1783
1364 1771
1784 1781
1059 1691
1609 1819
1561 1854
1031 1069
1846 1276
1254 1574
1479 1484
1708 1040
1093 1393
1680 1845
1414 1164
1523 1646
1296 1622
1480 1458
1348 1874
578 847
340 809
800 365
108 687
725 981
590 728
924 343
435 ...

result:

ok Accepted with 2791+2000 operations,sum of size(s)=9301+7327

Test #31:

score: 9
Accepted
time: 29ms
memory: 4232kb

input:

4
1854731567
100000 4000 200000 200000
998
946750857 946749479
898868556 898868101
2271278746 2271277916
1796596168 1796596321
161487283 161486866
1033814116 1033814195
2395521961 2395522326
1468519383 1468519080
2816096970 2816096367
1556209002 1556208501
3292442187 3292440851
1135140030 1135140110...

output:

Succeeded
2875 1996 13489 9304
1091 1501
1311 1634
1329 1749
718 984
1479 1745
131 146
1864 298
1146 1847
1510 1802
915 321
1032 1013
1561 430
40 747
1617 1730
1148 55
1036 560
90 681
589 692
1751 1709
1371 998
1614 72
1816 1653
1757 1086
49 402
1687 1443
1968 1679
1189 464
266 330
1462 697
1237 190...

result:

ok Accepted with 2875+1996 operations,sum of size(s)=13489+9304

Test #32:

score: 9
Accepted
time: 34ms
memory: 4396kb

input:

4
2073988041
100000 4000 200000 200000
998
3168161931 3168162584
641363905 641362895
3784715137 3784714618
3548409026 3548409673
2737710699 2737710016
3324804481 3324803425
60841104 60840338
2010919705 2010919496
2362840315 2362840326
369236350 369237998
3600238093 3600237006
75182169 75182747
23418...

output:

Succeeded
2919 1996 14108 9756
289 17
1728 561
1762 1626
1444 1099
1883 1944
1575 864
1789 1935
114 239
1718 1185
1804 342
1654 1166
1757 1532
1223 915
1529 849
1965 1670
1587 1466
1888 1391
419 468
1422 1194
1617 991
988 698
574 657
404 376
11 89
1372 1599
1433 242
1216 1994
1060 189
588 473
65 408...

result:

ok Accepted with 2919+1996 operations,sum of size(s)=14108+9756

Test #33:

score: 9
Accepted
time: 32ms
memory: 4236kb

input:

4
1770340944
100000 4000 200000 200000
998
619870796 619870703
3121053787 3121054050
4195183636 4195182734
3139119614 3139119172
3634777517 3634777854
3433281440 3433281395
1485638549 1485638667
1231357421 1231357552
1705009906 1705010057
3514693637 3514694012
4265358236 4265358262
964902776 9649023...

output:

Succeeded
2870 1996 13520 9260
212 13
1950 1598
552 218
1320 1986
1568 1086
1824 577
1720 1728
643 1620
533 593
1866 650
10 683
5 159
1246 1133
437 1852
1386 1856
213 705
1496 1964
1606 1354
1138 1221
1463 148
1306 1599
957 150
985 53
1206 1452
1446 1694
1451 623
336 562
882 55
611 1749
751 192
505 ...

result:

ok Accepted with 2870+1996 operations,sum of size(s)=13520+9260

Test #34:

score: 9
Accepted
time: 35ms
memory: 4220kb

input:

4
402901589
100000 4000 200000 200000
1000
1228378193 1228378597
1873458243 1873458214
2590411172 2590411391
3596693908 3596693672
442343415 442341879
1371534355 1371535333
1713867379 1713867258
2725534246 2725534433
3960722519 3960721503
1846001052 1846001387
2925453274 2925452776
1709191822 170919...

output:

Succeeded
2910 2000 14592 10103
1930 92
1761 1919
1177 1284
1046 1701
424 931
165 855
257 807
1230 1334
318 552
1101 1840
1434 1622
1069 1406
1029 1746
1049 1262
1366 1990
1102 1841
410 853
475 557
249 604
1184 1571
1893 23
280 382
1826 1875
1090 1704
1858 1484
1303 1820
1895 477
119 646
1708 1784
1...

result:

ok Accepted with 2910+2000 operations,sum of size(s)=14592+10103

Test #35:

score: 9
Accepted
time: 34ms
memory: 4396kb

input:

4
816997292
100000 4000 200000 200000
1000
3528745308 3528745448
2554369604 2554370028
2428697713 2428697760
2283123422 2283123636
2317970372 2317971439
3486243575 3486243354
914803066 914803223
3870938133 3870937913
833775363 833775109
133819724 133819108
4164722879 4164723079
4283955483 4283956051...

output:

Succeeded
2909 2000 14687 10188
1796 1814
138 246
1245 1753
1409 1464
1262 1931
1191 292
225 609
1790 170
1356 348
635 554
1147 1733
1420 1322
1902 1355
1389 1962
1285 1887
199 935
1553 1650
1168 1581
1481 1379
1319 1661
1739 335
1120 820
212 421
715 80
1402 1535
1468 986
615 260
1442 614
115 541
18...

result:

ok Accepted with 2909+2000 operations,sum of size(s)=14687+10188

Test #36:

score: 9
Accepted
time: 29ms
memory: 4220kb

input:

4
448483706
100000 4000 200000 200000
1000
3294405857 3294406138
1334269388 1334268750
3218236158 3218236229
1172020015 1172020961
4267095542 4267095785
884218942 884218794
2727697704 2727696787
4040088499 4040088016
3925649252 3925648708
3602778930 3602778977
25062275 25062940
782102904 782103485
4...

output:

Succeeded
2908 2000 14740 10158
119 946
1364 1941
1845 637
1990 1683
969 977
202 386
1008 1258
1583 1727
1797 1817
1155 1949
830 926
1960 95
1529 790
341 491
1420 1271
240 554
1113 1601
540 696
826 998
2 955
1306 1902
503 529
1243 1801
1688 1826
1192 440
1668 922
530 894
1017 1719
294 805
1999 1513
...

result:

ok Accepted with 2908+2000 operations,sum of size(s)=14740+10158

Test #37:

score: 9
Accepted
time: 11ms
memory: 4368kb

input:

4
1345753551
100000 4000 200000 200000
1000
2505101245 2505099844
1064732384 1064732096
3514288208 3514289196
4285598713 4285598588
289512304 289512216
961277738 961276571
270988037 270987782
351038556 351038779
2313748299 2313748400
3024327557 3024327268
1007549868 1007549449
3171882049 3171882337
...

output:

Succeeded
2222 2000 3254 4465
1515 629
1659 128
1079 146
861 148
1734 357
1465 438
1236 1720
1375 1357
609 950
1806 1880
250 1210
1749 1144
759 1514
198 1699
351 1417
1431 1291
665 445
1820 1434
1837 1222
531 1519
794 939
1044 1597
59 1414
508 314
1910 1800
1617 404
26 365
1277 769
539 920
1703 1234...

result:

ok Accepted with 2222+2000 operations,sum of size(s)=3254+4465

Test #38:

score: 9
Accepted
time: 15ms
memory: 4540kb

input:

4
163480472
100000 4000 200000 200000
998
2002085756 2002085748
2640607139 2640605823
836452341 836452238
179712028 179712352
1546416317 1546416341
3648734029 3648733547
4142213872 4142214412
711606286 711606592
1732581221 1732580465
2405962256 2405961750
1644716795 1644717277
589785362 589783494
12...

output:

Succeeded
2261 1996 3555 4561
1064 1444
1820 1368
1996 502
1795 1398
1481 29
1136 1661
1474 1563
1571 1586
1760 582
1113 1153
855 661
1193 561
999 624
1098 299
464 254
1049 1625
1736 1898
792 771
346 285
1047 1888
444 207
382 291
424 568
215 1291
1572 1085
492 721
1521 691
816 925
91 891
1017 784
11...

result:

ok Accepted with 2261+1996 operations,sum of size(s)=3555+4561

Subtask #5:

score: 11
Accepted

Test #39:

score: 11
Accepted
time: 30ms
memory: 4200kb

input:

5
1720909858
50000 4000 200000 100000
998
195378529 195378218
2138942224 2138942028
2421726252 2421725316
2614111628 2614111784
3778296551 3778295886
3346314089 3346313971
701234060 701233448
279201944 279202119
69826850 69826766
2173156660 2173157126
2982274003 2982273048
2306106121 2306107345
2808...

output:

Succeeded
2887 1996 13742 9435
463 1603
296 656
1774 971
986 1699
864 1965
1946 825
627 1526
1953 1403
1056 1003
786 238
1100 1605
902 1610
1277 1303
1470 1758
1620 1840
1378 764
566 1401
717 529
213 716
1745 1043
792 993
369 696
511 1586
15 1353
672 914
4 948
843 1058
732 122
1225 1142
947 1219
54 ...

result:

ok Accepted with 2887+1996 operations,sum of size(s)=13742+9435

Test #40:

score: 11
Accepted
time: 40ms
memory: 4404kb

input:

5
1942257410
50000 4000 200000 100000
999
164109252 164108690
821766476 821766590
800182177 800180581
3645999838 3646000976
4086503876 4086505410
2171679381 2171678745
2952329225 2952330453
1354218636 1354219071
1174819694 1174820521
2253012620 2253012650
1329779110 1329779087
2814346065 2814346500
...

output:

Succeeded
2697 1998 8763 6921
312 740
472 747
538 720
34 1056
1735 90
331 282
1605 1775
102 301
31 1024
322 414
708 1371
62 859
1063 104
1662 1535
1238 1974
1513 1340
346 488
1798 341
1724 1184
1828 1674
907 1069
1681 568
1606 1767
285 1514
1269 1508
70 274
1474 1309
298 1221
1088 367
1699 103
155 4...

result:

ok Accepted with 2697+1998 operations,sum of size(s)=8763+6921

Test #41:

score: 11
Accepted
time: 18ms
memory: 4236kb

input:

5
161065852
50000 4000 200000 100000
1000
2966551129 2966552287
2856618787 2856618848
3795294524 3795295808
2757765097 2757764165
676105640 676105847
570204851 570205160
511088706 511090077
3497329264 3497329269
3725322378 3725322886
527017111 527016211
4071607765 4071607337
2817593784 2817593642
15...

output:

Succeeded
2393 2000 3963 4850
1387 1898
1362 432
98 1697
1779 1719
1073 203
1646 1274
666 1359
1914 1959
1328 1351
1812 220
1695 1307
1875 410
1058 1198
664 660
544 265
1358 768
1809 1651
1574 1587
39 105
1290 814
1747 108
1834 1320
1319 833
492 1244
313 1980
323 510
769 613
289 629
1879 527
826 577...

result:

ok Accepted with 2393+2000 operations,sum of size(s)=3963+4850

Test #42:

score: 11
Accepted
time: 34ms
memory: 4236kb

input:

5
777230405
50000 4000 200000 100000
999
3830467265 3830466694
1849159126 1849158949
2825053043 2825052212
2761591040 2761591070
939276197 939275664
3367167096 3367167288
3727731406 3727730932
406701926 406701618
530187802 530186715
3962995171 3962996546
1787609584 1787609620
993000803 993000542
158...

output:

Succeeded
2896 1998 13935 9688
1062 1958
1189 1649
1976 792
560 130
1297 1223
501 975
1305 706
1151 632
739 1619
1205 189
590 705
218 382
844 1079
763 1099
78 1604
968 996
492 1899
1067 821
1640 1117
1493 1383
1342 1596
1761 1966
1464 1988
1700 1797
1817 1201
1780 891
1772 1198
1692 1534
1764 1910
1...

result:

ok Accepted with 2896+1998 operations,sum of size(s)=13935+9688

Test #43:

score: 11
Accepted
time: 32ms
memory: 4104kb

input:

5
97972513
50000 4000 200000 100000
999
654921388 654921281
3336987454 3336987177
439399097 439398662
1551555981 1551555288
3555879532 3555880729
2903638861 2903639277
257794283 257794433
3826111358 3826111966
1708274143 1708274017
3746235685 3746236123
907908447 907908765
4116365217 4116364822
1582...

output:

Succeeded
2901 1998 13518 9325
1270 167
402 1947
857 1421
1862 681
1631 1820
914 620
1816 1442
1174 1028
171 155
785 1440
11 1173
1196 126
1135 395
1247 1842
875 958
763 1069
1215 1961
440 532
789 793
311 758
1493 1690
665 659
64 1224
1387 1258
287 842
416 455
24 1640
173 1630
378 912
429 1605
316 1...

result:

ok Accepted with 2901+1998 operations,sum of size(s)=13518+9325

Test #44:

score: 11
Accepted
time: 29ms
memory: 4132kb

input:

5
397162223
50000 4000 200000 100000
1000
2103775764 2103775539
3507938589 3507938863
4080657108 4080657210
2492592687 2492593001
111756474 111755329
3545417212 3545415789
3115563885 3115563458
2404092040 2404092248
1717324095 1717323827
2910355772 2910355898
40550063 40549395
1332934233 1332933830
...

output:

Succeeded
2882 2000 13269 9245
33 935
818 1998
162 498
373 844
680 689
481 972
1653 1013
451 587
292 1367
531 551
275 922
35 867
1415 669
889 393
1862 762
1001 1229
1391 1166
1272 1248
722 729
446 177
224 870
1565 995
389 773
348 1507
1057 845
406 112
327 456
1086 672
174 576
477 372
89 948
1289 800...

result:

ok Accepted with 2882+2000 operations,sum of size(s)=13269+9245

Test #45:

score: 11
Accepted
time: 2ms
memory: 4432kb

input:

5
1695502059
50000 4000 200000 100000
1000
700852541 700853138
286392703 286393228
862046288 862047179
1594299681 1594299408
3210366802 3210366961
1413959809 1413960445
3698437765 3698437869
1377184122 1377184197
281217513 281217619
145372596 145373148
502398350 502398463
2741843047 2741843594
34564...

output:

Succeeded
1473 2000 1473 2946
1574 1095
1512 1281
1214 1140
1889 1248
1398 1695
1680 1976
1346 1564
1867 1874
1429 1712
1317 1578
1632 1623
1276 1501
1463 1032
1179 1903
1156 1542
1684 1866
1906 1122
1348 1831
1390 1663
1322 1561
1028 1777
1174 1170
1892 1981
1094 1059
1702 1407
1745 1188
1557 1533
...

result:

ok Accepted with 1473+2000 operations,sum of size(s)=1473+2946

Test #46:

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

input:

5
1256148136
50000 4000 200000 100000
999
2016310630 2016310917
2107471344 2107470258
3472709132 3472709188
289824693 289824187
968116627 968117102
254957789 254959335
3918543752 3918543310
3679196968 3679195694
2994473794 2994473552
4244660702 4244660526
1565613257 1565613765
4153244320 4153244472
...

output:

Succeeded
1875 1998 1875 3750
1119 254
1348 894
140 115
382 1312
1968 1018
1197 1662
1523 1153
1223 1773
407 1100
896 1185
1752 587
231 1353
1281 156
1621 130
333 1292
1593 1990
256 1898
688 1565
1286 1564
1913 86
1317 409
142 1933
512 1884
1649 1098
742 749
1665 437
288 1924
422 997
945 1421
1447 1...

result:

ok Accepted with 1875+1998 operations,sum of size(s)=1875+3750

Test #47:

score: 11
Accepted
time: 2ms
memory: 4500kb

input:

5
174080677
50000 4000 200000 100000
1000
3686639308 3686638800
2896535064 2896534994
942582287 942582342
1036404485 1036404700
2240524876 2240525002
885623407 885623800
2908065975 2908066813
132144926 132144327
4212166510 4212165968
2576925241 2576925211
2854923688 2854924082
4019207120 4019206802
...

output:

Succeeded
33 2000 33 66
826 15
722 1642
700 588
170 383
827 63
622 480
245 87
894 392
777 893
1295 354
364 682
365 729
519 471
780 1905
528 586
806 306
246 937
410 872
96 264
183 548
376 786
229 317
19 415
860 982
986 116
598 808
418 745
212 862
214 201
581 854
730 497
422 393
458 483
635 571
1699 2...

result:

ok Accepted with 33+2000 operations,sum of size(s)=33+66

Test #48:

score: 11
Accepted
time: 21ms
memory: 4168kb

input:

5
1245824305
50000 4000 200000 100000
1000
3667004853 3667004169
2287697139 2287696730
2209822990 2209823892
4121239467 4121237803
1095196087 1095194911
1774546551 1774545134
1362722072 1362721338
1986032138 1986033160
3134483043 3134484458
3770232965 3770233774
4150800332 4150798469
444018341 44401...

output:

Succeeded
2729 2000 13061 8498
146 1067
102 1574
95 1528
927 1387
461 1621
439 1638
489 1353
328 1043
173 1217
536 1358
789 1562
677 1987
486 1499
831 1594
147 1516
23 1154
479 1864
476 1686
447 1400
50 1886
38 1809
445 1009
438 1207
675 1373
141 1413
652 1025
259 1783
814 1695
185 1304
125 1522
360...

result:

ok Accepted with 2729+2000 operations,sum of size(s)=13061+8498

Test #49:

score: 11
Accepted
time: 17ms
memory: 4412kb

input:

5
1416201142
50000 4000 200000 100000
999
2694326229 2694325190
3006267026 3006266271
3590771525 3590772511
382357401 382355920
3477874958 3477875914
653232151 653234151
4226125318 4226123972
2278771395 2278772384
2110222591 2110223909
3320640593 3320639898
2013976833 2013977782
2032673776 203267476...

output:

Succeeded
2728 1998 13290 8566
730 1137
216 1398
56 1007
831 1399
452 1695
288 1070
573 1331
379 1700
727 1966
256 1050
986 1612
267 1677
408 1199
918 1494
243 1342
669 1330
302 1712
446 1351
748 1367
500 1507
677 1871
839 1384
125 1536
953 1785
713 1760
51 1276
430 1433
104 1884
604 1992
808 1894
4...

result:

ok Accepted with 2728+1998 operations,sum of size(s)=13290+8566

Subtask #6:

score: 12
Accepted

Test #50:

score: 12
Accepted
time: 32ms
memory: 4392kb

input:

6
889180297
25000 4000 200000 100000
998
3680334935 3680334330
2957217208 2957215867
3096097757 3096097331
2843029536 2843030717
2270437916 2270437982
1841161075 1841160444
3671823118 3671823208
2166904224 2166903071
2760262295 2760263328
880472976 880472564
3147819342 3147820514
3366602035 33666019...

output:

Succeeded
2784 1996 14225 9579
353 277
1638 557
618 783
1047 1680
861 919
1032 1184
1973 135
1041 1604
766 294
1970 1035
100 1152
416 1925
176 366
1020 1739
1590 1580
1322 468
456 552
1105 61
1552 872
1072 1405
15 37
81 779
1845 57
1064 1587
1791 1585
1901 659
1502 1927
1602 240
75 26
1364 1615
1846...

result:

ok Accepted with 2784+1996 operations,sum of size(s)=14225+9579

Test #51:

score: 12
Accepted
time: 31ms
memory: 4396kb

input:

6
1393953829
25000 4000 200000 100000
999
945306191 945306676
862749063 862750710
1587703663 1587703760
2321904837 2321905131
3322741249 3322741330
128629140 128628755
4061072808 4061073316
3009230812 3009229891
3626184675 3626183179
3701144497 3701145089
1334455826 1334454368
3195102134 3195101407
...

output:

Succeeded
2777 1998 14472 9660
217 403
1215 795
962 475
1614 1838
1498 1781
1711 1780
89 354
1705 698
1317 507
1560 1850
1758 972
111 47
1697 1604
1059 260
298 1542
29 883
1691 373
1280 1703
664 736
1584 1381
1035 1786
102 952
199 802
1332 981
1585 203
1823 319
856 500
1884 79
1669 633
1192 455
1916...

result:

ok Accepted with 2777+1998 operations,sum of size(s)=14472+9660

Test #52:

score: 12
Accepted
time: 18ms
memory: 4224kb

input:

6
2137907583
25000 4000 200000 100000
1000
99249012 99249101
3089074242 3089075163
3142929261 3142928885
3509452069 3509452074
4100326210 4100325388
2027856240 2027856707
1667832698 1667832002
239393593 239393607
3323558397 3323558267
87270863 87271227
2749644672 2749644377
3753692402 3753692989
671...

output:

Succeeded
2433 2000 9360 6850
34 104
146 156
168 227
250 267
299 310
387 468
1034 1055
1082 1117
1134 1186
1206 1215
1069 1178
1197 1248
1299 1313
1322 1350
1376 1454
1611 1625
1731 1754
1794 1893
1980 1237
1221 1288
1401 1418
1436 1474
1485 1542
1563 1573
1578 1608
1643 1670
1696 1705
1721 1724
172...

result:

ok Accepted with 2433+2000 operations,sum of size(s)=9360+6850

Test #53:

score: 12
Accepted
time: 14ms
memory: 4236kb

input:

6
620581501
25000 4000 200000 100000
999
2430495051 2430494760
2342044260 2342044349
4168624383 4168624716
4153034330 4153033041
113541062 113539588
3734354027 3734355235
204355212 204355044
2304848470 2304848423
2783072361 2783073753
431065913 431066151
800004122 800004842
3667276533 3667275783
229...

output:

Succeeded
2336 1998 7942 6304
3 18
44 109
106 156
1612 1054
1019 1629
1101 1772
1496 1320
1861 1888
1237 1556
1140 1024
1686 1886
1919 1308
1257 1402
1302 1485
1880 1666
1291 1949
1181 1965
395 857
164 168
695 174
185 240
250 268
273 301
354 361
427 718
595 651
655 798
543 621
570 244
127 490
717 60...

result:

ok Accepted with 2336+1998 operations,sum of size(s)=7942+6304

Test #54:

score: 12
Accepted
time: 17ms
memory: 4256kb

input:

6
1540179210
25000 4000 200000 100000
998
908025469 908025772
4110515646 4110516139
1434161137 1434160239
4210047633 4210047681
2756906765 2756906979
773613891 773613906
3984390566 3984390788
1117864605 1117864853
379534092 379533510
3317517762 3317518164
1919343058 1919344136
1048781877 1048782644
...

output:

Succeeded
2355 1996 9054 6737
656 703
619 219
62 677
131 220
250 272
292 379
400 401
421 551
10 37
54 86
92 112
1055 1117
1202 1239
1352 1424
1904 1284
1483 1647
1855 1001
1926 1908
1385 1464
1691 1549
1682 1596
1477 1466
1832 1158
1043 1510
1588 1718
1772 1799
1818 1927
1933 1987
1882 1789
1645 163...

result:

ok Accepted with 2355+1996 operations,sum of size(s)=9054+6737

Test #55:

score: 12
Accepted
time: 10ms
memory: 4260kb

input:

6
218843024
25000 4000 200000 100000
1000
4003665165 4003664581
989541263 989541162
1710766055 1710765338
3659822362 3659822800
2654208269 2654208393
1491873748 1491873450
1160537498 1160536441
3762298781 3762298020
3903551469 3903551390
4248337091 4248336400
1517118005 1517118186
399918797 39991852...

output:

Succeeded
2187 2000 7698 6039
396 730
685 132
250 480
762 695
927 558
339 940
85 218
110 598
270 522
942 46
917 840
841 677
899 391
629 371
50 425
980 461
329 805
113 446
128 675
989 320
123 662
682 610
918 516
933 963
32 532
709 337
670 137
964 165
138 207
549 706
419 851
360 577
7 122
210 322
511 ...

result:

ok Accepted with 2187+2000 operations,sum of size(s)=7698+6039

Test #56:

score: 12
Accepted
time: 9ms
memory: 4280kb

input:

6
846170590
25000 4000 200000 100000
998
1218684893 1218683879
1552665572 1552664853
3443478269 3443477570
1790763876 1790763016
1025362073 1025360149
2654707482 2654705839
1494316579 1494316380
2068116991 2068116277
331974024 331973737
1788075132 1788074334
953158534 953158009
586401169 586400597
2...

output:

Succeeded
2062 1996 7099 5630
82 333
338 529
548 557
745 83
297 602
697 451
161 851
47 621
703 372
252 814
638 590
280 427
997 12
922 984
821 664
622 754
960 733
541 544
331 406
894 277
299 480
320 787
90 970
221 382
835 575
457 952
491 53
135 140
144 160
176 177
8 26
43 45
88 133
138 162
883 402
69...

result:

ok Accepted with 2062+1996 operations,sum of size(s)=7099+5630

Test #57:

score: 12
Accepted
time: 14ms
memory: 4260kb

input:

6
681304959
25000 4000 200000 100000
999
2726760615 2726761129
4070002268 4070002314
2698967410 2698967313
3149535258 3149536218
3426049564 3426049397
1255425746 1255425945
273472210 273471617
432940843 432940957
539629098 539628555
625817515 625817025
2355613233 2355613594
10360141 10360443
3239718...

output:

Succeeded
2117 1998 12558 7055
6 8
15 17
22 27
32 34
38 39
40 41
43 49
51 53
57 61
66 70
83 87
89 92
95 96
106 116
117 122
123 131
136 138
146 150
156 164
170 174
188 189
190 193
194 199
201 202
203 204
214 215
216 218
224 228
242 244
3 16
18 29
36 62
71 79
98 110
112 118
120 121
125 153
165 167
173...

result:

ok Accepted with 2117+1998 operations,sum of size(s)=12558+7055

Test #58:

score: 12
Accepted
time: 14ms
memory: 4280kb

input:

6
1240372772
25000 4000 200000 100000
1000
1759289079 1759288926
1933352834 1933352077
347838835 347839028
2202749992 2202750871
3939036060 3939035178
3009870817 3009869983
3748040393 3748040424
864310002 864310105
1129152802 1129153119
718780908 718780600
1884330497 1884330296
2050569859 2050569350...

output:

Succeeded
1873 2000 10542 6395
3 12
13 14
16 18
20 21
22 24
26 27
30 34
37 38
39 44
45 49
53 54
56 60
63 64
67 69
70 72
73 75
76 81
82 83
85 86
88 91
93 94
95 97
99 102
103 105
106 108
109 110
111 112
113 114
115 118
125 126
129 132
133 135
136 137
139 142
143 147
151 152
154 158
160 163
164 165
166...

result:

ok Accepted with 1873+2000 operations,sum of size(s)=10542+6395

Subtask #7:

score: 14
Accepted

Test #59:

score: 14
Accepted
time: 32ms
memory: 4220kb

input:

7
1561772597
25000 4000 200000 100000
1000
834919143 834919090
162625904 162627303
1067517190 1067517712
3410644901 3410644677
2728503196 2728502622
4133685425 4133685598
976760503 976760426
2101358026 2101358499
3583017242 3583017016
1743218912 1743220527
2609984627 2609985177
3915259025 3915259188...

output:

Succeeded
2758 2000 14176 9612
939 263
1313 1546
1449 89
1405 313
799 535
560 1788
236 421
1012 1158
1049 1325
40 928
1676 982
1352 725
1483 393
1338 752
673 62
840 1256
480 95
380 1073
534 1120
54 232
1846 105
539 777
885 475
446 57
97 440
650 96
1468 1773
1088 1261
34 732
883 1926
261 851
452 1213...

result:

ok Accepted with 2758+2000 operations,sum of size(s)=14176+9612

Test #60:

score: 14
Accepted
time: 2ms
memory: 4452kb

input:

7
1336630764
25000 4000 200000 100000
999
3754204676 3754204263
661669146 661669691
3383866850 3383866634
4286058306 4286058462
275363558 275362939
490879941 490879205
3048247936 3048247911
60895431 60895902
2012261918 2012261908
2305570243 2305570248
2756619485 2756618373
766927763 766927449
261527...

output:

Succeeded
821 1998 823 1642
1585 1793
1885 1955
1113 1716
1922 1910
1817 1796
1062 1426
1886 1442
1204 1633
1034 1469
1198 1780
1003 1709
1692 1238
1758 1066
1202 1774
1443 1842
1367 1507
1404 1935
1101 1221
1912 1726
1170 1455
1251 1126
1928 1265
1215 1117
1331 1225
1657 1419
1448 1566
1631 1897
14...

result:

ok Accepted with 821+1998 operations,sum of size(s)=823+1642

Test #61:

score: 14
Accepted
time: 34ms
memory: 4404kb

input:

7
1779405874
25000 4000 200000 100000
1000
4131992564 4131991606
1062232027 1062231506
3582875319 3582875068
1679869647 1679869620
3772280193 3772280538
4214125072 4214124839
2659083848 2659083347
1373877441 1373877158
1844973250 1844972076
3526061965 3526060499
2547082343 2547083157
1838200915 1838...

output:

Succeeded
2684 2000 8723 6837
378 84
1366 999
1934 1325
813 768
1988 670
1951 1300
1345 1704
1688 810
1956 490
1250 889
1306 470
1412 422
1336 1805
1310 1228
792 1349
849 1229
1652 1270
1259 701
1677 271
1309 1611
998 1965
1424 1913
259 208
284 1524
970 1339
1905 1021
1299 1480
785 387
3 845
1895 72...

result:

ok Accepted with 2684+2000 operations,sum of size(s)=8723+6837

Test #62:

score: 14
Accepted
time: 26ms
memory: 4236kb

input:

7
1570401939
25000 4000 200000 100000
998
3148646883 3148647333
3472091054 3472090123
278894780 278894651
57610944 57610331
1860420864 1860420782
2989090556 2989090327
4158835568 4158834777
196113056 196114393
2109982628 2109981735
3313427840 3313427593
1791526870 1791526564
871045252 871046635
1321...

output:

Succeeded
2772 1996 14943 9988
60 334
644 1299
1310 193
1886 359
230 1955
353 1706
756 1934
733 1797
221 1098
920 1395
1782 1443
1155 1868
1927 140
1174 726
194 761
1872 1053
703 1585
803 762
350 1620
464 179
1433 180
28 886
532 1163
1548 657
598 1534
117 576
1681 162
267 580
585 1827
907 939
1132 1...

result:

ok Accepted with 2772+1996 operations,sum of size(s)=14943+9988

Test #63:

score: 14
Accepted
time: 17ms
memory: 4472kb

input:

7
1450625915
25000 4000 200000 100000
1000
1109002343 1109003135
22686111 22686391
708137842 708137834
1827926645 1827926257
4068418853 4068418436
3173412806 3173411005
435305565 435304885
663912650 663913396
3575081618 3575082276
2005743663 2005744468
2259422734 2259422527
1400805550 1400806829
101...

output:

Succeeded
2328 2000 9107 6957
684 18
5 27
97 767
1997 62
231 1233
418 1090
83 99
1006 256
1388 525
96 726
735 1024
1133 1151
1452 1602
102 135
169 172
175 178
1947 409
638 1677
43 107
865 112
349 531
801 962
414 1000
1116 1731
1755 1768
217 229
233 266
296 302
313 314
88 140
173 346
359 440
471 511
...

result:

ok Accepted with 2328+2000 operations,sum of size(s)=9107+6957

Test #64:

score: 14
Accepted
time: 19ms
memory: 4204kb

input:

7
135746746
25000 4000 200000 100000
999
3854621486 3854622490
1569079030 1569077610
3987490504 3987489881
1484524078 1484524939
1470817867 1470817629
2723442111 2723441053
3895536593 3895535810
4009379127 4009379481
830706098 830707463
32509494 32508360
1070489719 1070490536
3334764196 3334762664
5...

output:

Succeeded
2303 1998 6766 5944
2 98
132 184
600 191
589 310
1288 373
297 393
451 461
466 474
511 531
33 634
632 640
650 653
667 675
684 704
863 1458
1612 870
1149 1448
1472 1008
550 1146
1837 628
1180 1155
1927 1138
770 891
601 548
1640 691
556 148
742 1738
180 525
384 725
877 1156
1593 674
1886 1647...

result:

ok Accepted with 2303+1998 operations,sum of size(s)=6766+5944

Test #65:

score: 14
Accepted
time: 14ms
memory: 4252kb

input:

7
2111844098
25000 4000 200000 100000
999
131730287 131729491
4234622692 4234621839
1894854842 1894855171
1857632532 1857633676
3106353509 3106353801
2640063239 2640064499
921644037 921643352
3957407885 3957409750
2539548444 2539548384
2096058913 2096059646
3789843675 3789842850
3719590991 371959020...

output:

Succeeded
2220 1998 6130 5880
15 32
224 239
258 292
313 369
477 493
511 541
551 621
649 825
56 59
66 71
85 155
184 185
190 196
238 359
382 410
432 433
544 582
606 607
618 627
630 686
787 807
812 843
305 282
1162 1773
412 1835
1040 722
918 654
585 876
657 1851
1869 470
844 93
22 708
1769 48
30 1200
3...

result:

ok Accepted with 2220+1998 operations,sum of size(s)=6130+5880

Test #66:

score: 14
Accepted
time: 14ms
memory: 4260kb

input:

7
641335315
25000 4000 200000 100000
999
122084504 122085088
4017276980 4017277724
19577205 19577638
609865507 609864840
2949642502 2949642300
1449572439 1449573269
2586554784 2586554671
3749879720 3749879330
805233097 805233176
3505563718 3505564210
3463027822 3463028639
56206486 56206377
174519616...

output:

Succeeded
2141 1998 12454 7013
8 11
15 16
18 19
21 22
35 43
50 51
52 56
57 64
68 73
75 82
86 90
92 103
110 113
115 117
118 121
132 135
136 137
156 157
160 162
170 171
172 176
180 188
190 192
198 199
200 203
214 220
221 223
237 238
247 258
262 267
273 278
282 283
284 289
291 293
296 301
303 311
314 3...

result:

ok Accepted with 2141+1998 operations,sum of size(s)=12454+7013

Test #67:

score: 14
Accepted
time: 15ms
memory: 4488kb

input:

7
1902724585
25000 4000 200000 100000
999
2412323026 2412323115
1989891554 1989891443
2773765341 2773765514
265447302 265447090
4117457062 4117457651
1482561312 1482560953
1406096926 1406097254
705631463 705631517
1803953538 1803953889
458839460 458839350
1879258721 1879258324
1880425144 1880424987
...

output:

Succeeded
1911 1998 10673 6541
3 4
7 10
11 12
19 21
22 23
25 26
28 30
34 35
37 39
45 46
47 48
49 52
53 54
55 59
61 62
63 67
69 70
71 73
74 75
76 79
82 83
84 85
86 91
93 98
106 107
108 110
112 114
115 119
121 122
123 127
128 129
130 132
133 134
136 138
141 144
148 150
151 153
156 157
159 162
163 165
...

result:

ok Accepted with 1911+1998 operations,sum of size(s)=10673+6541

Test #68:

score: 14
Accepted
time: 21ms
memory: 4220kb

input:

7
1304909866
25000 4000 200000 100000
999
1295903888 1295903022
3932878443 3932876957
2811484715 2811485941
1438514539 1438514070
3806386020 3806385111
3192192194 3192192414
1991099750 1991098370
2746660665 2746658904
3585441978 3585443592
1667685273 1667682831
263427952 263426365
4181260055 4181258...

output:

Succeeded
2721 1998 12957 8284
652 1716
314 1723
25 1497
159 1587
227 1943
154 1593
36 1165
446 1156
169 1535
756 1817
717 1305
697 1477
540 1845
600 1608
217 1260
282 1494
417 1251
356 1280
947 1669
927 1395
786 1815
844 1524
96 1164
954 1960
193 1605
229 1071
92 1947
689 1881
471 1029
586 1096
656...

result:

ok Accepted with 2721+1998 operations,sum of size(s)=12957+8284

Test #69:

score: 14
Accepted
time: 26ms
memory: 4136kb

input:

7
1317463763
25000 4000 200000 100000
998
2526685232 2526686705
1167751659 1167752904
4129542793 4129542553
845923368 845923839
2137792880 2137793312
2457480648 2457479423
3722627917 3722628322
1641737839 1641737029
1524460390 1524460841
24205870 24206552
796248162 796249277
3238897910 3238899020
37...

output:

Succeeded
2788 1996 12917 9068
955 1150
1618 181
777 1801
1177 633
762 1119
354 1830
1492 746
379 1104
435 1273
522 1613
1068 992
271 1639
923 1928
377 1437
783 1152
367 1637
938 1489
91 1518
456 653
803 1569
521 1823
558 1006
362 831
439 1383
1159 553
1092 906
1058 1228
919 1207
880 1277
448 1278
3...

result:

ok Accepted with 2788+1996 operations,sum of size(s)=12917+9068

Subtask #8:

score: 10
Accepted

Test #70:

score: 10
Accepted
time: 993ms
memory: 6060kb

input:

8
1311447458
50000 100000 500000 200000
4999
173190562 173182163
1078196947 1078197142
1215565665 1215571165
1186082670 1186081354
2422459084 2422459806
2626070241 2626074599
207492448 207494582
2266700305 2266695214
1679673055 1679672568
3879988278 3879982030
254940475 254941572
3919251618 39192495...

output:

Succeeded
13910 9998 96481 60268
438 1028
6245 4292
7727 584
2570 712
2416 6570
9316 7626
1091 2873
1644 547
4472 1371
7904 6048
113 1430
4435 7604
3135 5762
8733 9450
7369 9746
792 4742
4810 7429
4740 9965
4126 7988
5083 1594
1566 1598
2392 1846
274 3124
1443 8636
8867 4357
1474 8651
175 2214
544 5...

result:

ok Accepted with 13910+9998 operations,sum of size(s)=96481+60268

Test #71:

score: 10
Accepted
time: 3ms
memory: 7744kb

input:

8
146283890
50000 100000 500000 200000
4998
2993119013 2993115357
4268970052 4268971874
808002542 808006552
892885669 892881200
2460117409 2460115710
3324732245 3324732140
54868859 54854998
1804229854 1804227421
450513797 450514478
1104546934 1104547705
2070884692 2070873353
379400982 379401581
3321...

output:

Succeeded
2332 9996 2413 4664
6419 3665
1113 3382
496 966
1989 501
7157 8953
8167 6260
7561 9201
9398 5841
6725 6967
9583 5097
8986 9915
7098 5827
8640 9970
7250 5771
8481 6176
6729 9821
6287 9456
9502 8972
5714 7089
7650 6892
5993 6335
9353 6905
6931 9960
9934 5766
6482 6591
5702 9861
6518 6950
915...

result:

ok Accepted with 2332+9996 operations,sum of size(s)=2413+4664

Test #72:

score: 10
Accepted
time: 799ms
memory: 6392kb

input:

8
359304486
50000 100000 500000 200000
4999
1094705883 1094709685
1722131883 1722132595
2997024384 2997026636
3860480932 3860484415
628475092 628485245
2336751135 2336748598
3814389699 3814390104
2291095406 2291091625
2583462746 2583462819
2798317408 2798309538
2146225602 2146229179
2197058314 21970...

output:

Succeeded
13722 9998 44878 34914
5126 3025
1134 1256
8326 4622
4485 1935
1823 5724
3329 4995
8165 1187
4192 768
8768 5844
7005 1819
5513 1535
3285 3929
2386 3593
2077 4355
8579 7653
4430 7405
5928 7500
8072 7305
3135 3569
9887 1460
8651 1273
1783 5984
1314 8202
8487 2674
7438 1220
5236 4892
3385 494...

result:

ok Accepted with 13722+9998 operations,sum of size(s)=44878+34914

Test #73:

score: 10
Accepted
time: 954ms
memory: 6044kb

input:

8
274726151
50000 100000 500000 200000
4999
3419263031 3419258906
2999444481 2999444350
3939520462 3939526440
2959958627 2959955437
3179200434 3179194481
314093006 314083104
1172908290 1172911855
4164171409 4164165636
4266437323 4266441231
938450767 938450959
3402967524 3402968757
2430673118 2430680...

output:

Succeeded
13947 9998 96981 61035
1588 5999
4425 7498
5071 5172
9020 3307
9254 6854
2548 5572
6732 576
8441 8669
555 9065
2744 9097
3267 8976
234 7052
9139 5095
777 1576
8214 2529
3374 1459
1681 2907
3281 1426
730 3351
4901 2719
2052 386
40 2363
2968 4730
4594 5716
4833 5408
4021 9753
9905 1786
4829 ...

result:

ok Accepted with 13947+9998 operations,sum of size(s)=96981+61035

Test #74:

score: 10
Accepted
time: 398ms
memory: 6096kb

input:

8
36542142
50000 100000 500000 200000
4998
1882767946 1882768363
2002146634 2002148253
2634053693 2634052789
1026701278 1026688769
2616046340 2616047360
3871226190 3871226271
826813115 826802828
407974325 407972617
308792051 308793619
1589844798 1589845765
2250581592 2250578704
1119903193 1119902668...

output:

Succeeded
12237 9996 62153 40645
3025 9192
8492 2701
1295 9520
6351 4376
182 9390
9456 3596
5430 6529
7205 7820
8227 1292
9286 1040
305 7107
9443 9324
8018 6606
649 790
4590 2420
1259 3350
3533 4345
4518 4609
6288 7191
69 401
2834 2977
5671 4019
1123 6879
3231 5251
4802 2114
2624 4798
7142 7348
6640...

result:

ok Accepted with 12237+9996 operations,sum of size(s)=62153+40645

Test #75:

score: 10
Accepted
time: 434ms
memory: 6392kb

input:

8
1487850256
50000 100000 500000 200000
4998
1811651536 1811650670
345905379 345902625
2279108766 2279111434
2091518940 2091524010
3909207465 3909209873
3388023095 3388020461
4146491221 4146487463
335162845 335161804
1825736789 1825741802
4134879931 4134887877
954293244 954286743
619524094 619526641...

output:

Succeeded
12011 9996 57326 38020
2515 8613
1765 5193
2538 2216
5120 6110
5092 1396
9509 5509
3010 3225
1592 504
5234 8204
4034 2357
3068 2449
2183 7163
2451 9171
9324 8958
8804 1329
3939 8386
2129 6405
6413 4444
2496 4659
1547 1480
7117 8088
8129 9286
5924 7148
3553 5498
6447 7509
5452 4956
4381 814...

result:

ok Accepted with 12011+9996 operations,sum of size(s)=57326+38020

Test #76:

score: 10
Accepted
time: 374ms
memory: 6232kb

input:

8
1221498280
50000 100000 500000 200000
4998
2995611046 2995612152
3821228370 3821223946
2603755886 2603749274
4253723935 4253721827
1284666231 1284667975
3724747876 3724742578
511189298 511194763
3517774027 3517770230
3839257128 3839260219
2120621563 2120626674
2987809269 2987806806
4029661482 4029...

output:

Succeeded
11201 9996 51352 35220
6540 4847
3423 6983
7308 5001
6949 6419
5603 7977
8733 8292
4591 5925
691 8166
571 6573
9967 3162
5292 1305
1922 7609
6154 8766
2079 6625
683 8863
8814 2397
3200 126
78 148
371 548
552 653
844 1037
1854 1873
1891 1898
1995 2683
7465 2829
132 186
189 460
523 583
1057 ...

result:

ok Accepted with 11201+9996 operations,sum of size(s)=51352+35220

Test #77:

score: 10
Accepted
time: 330ms
memory: 6000kb

input:

8
587527602
50000 100000 500000 200000
4999
3568373793 3568376644
1120949625 1120946940
415496958 415496926
12393946 12392788
386545771 386532889
4139741816 4139743781
561101154 561098999
256455977 256456345
3867681645 3867688124
934936599 934942934
3224959264 3224945918
3353558087 3353557351
100232...

output:

Succeeded
9429 9998 69435 37687
3 6
13 15
16 19
22 25
26 27
28 30
31 32
33 36
37 38
41 43
44 46
47 48
49 51
52 54
55 56
57 58
62 64
65 71
72 73
74 75
76 81
83 85
86 89
90 92
94 96
102 103
104 108
109 110
111 113
114 115
117 119
124 125
126 127
130 131
132 139
140 145
148 150
154 156
157 159
161 163
...

result:

ok Accepted with 9429+9998 operations,sum of size(s)=69435+37687

Test #78:

score: 10
Accepted
time: 309ms
memory: 6012kb

input:

8
1394126129
50000 100000 500000 200000
5000
3535160872 3535160998
2231302465 2231289478
456729403 456731555
2086709903 2086708267
4035270421 4035268777
3771632269 3771645711
4192491848 4192489822
3316315203 3316302642
1887846361 1887831530
1613070769 1613085466
1693599113 1693601030
4198542233 4198...

output:

Succeeded
11061 10000 87072 40180
20 26
41 49
72 89
93 110
115 124
126 128
133 134
137 146
152 156
163 169
171 187
192 226
234 237
238 240
247 256
268 271
274 284
301 312
327 330
340 343
356 367
380 383
384 386
390 391
397 405
409 429
442 464
475 476
495 498
505 508
511 533
543 554
560 573
574 580
5...

result:

ok Accepted with 11061+10000 operations,sum of size(s)=87072+40180

Test #79:

score: 10
Accepted
time: 549ms
memory: 6148kb

input:

8
798061011
50000 100000 500000 200000
4998
909931267 909922860
4047965918 4047969477
3648796296 3648794907
4128167602 4128163056
937507996 937506719
3406709348 3406716060
2859206410 2859204776
3876175763 3876164150
104431102 104422384
3251853137 3251856828
4215276376 4215282690
2479989695 247999056...

output:

Succeeded
13933 9996 88083 56119
2204 6067
1670 6126
1795 6217
345 6069
347 8132
2195 7437
247 6316
1839 8776
4403 8527
1799 7056
867 8774
2380 9176
7918 1153
1144 5883
3566 6525
2682 7338
5952 733
8262 2901
1638 6737
421 7170
934 8730
354 7566
613 7853
456 9989
655 5432
3891 8053
4233 9590
2762 504...

result:

ok Accepted with 13933+9996 operations,sum of size(s)=88083+56119

Test #80:

score: 10
Accepted
time: 590ms
memory: 6124kb

input:

8
656855851
50000 100000 500000 200000
4999
505382265 505388755
3711069187 3711071188
2063994872 2063998683
467498120 467489115
1612163573 1612159860
1652695836 1652701825
854925443 854917595
1815956515 1815955989
3950893219 3950889646
2218879655 2218869478
207692325 207699864
2160331192 2160333277
...

output:

Succeeded
14040 9998 88382 56424
169 5026
1262 8124
3795 8660
4080 7138
1718 9569
3314 9425
5500 2408
3016 5314
2243 8466
3293 8513
1048 6120
2834 7310
2530 9667
2345 8097
6334 9499
3377 6574
648 5284
264 7249
4491 9156
3471 5975
4013 9230
3554 9890
480 7754
11 4514
2150 8623
6271 2042
1871 7924
117...

result:

ok Accepted with 14040+9998 operations,sum of size(s)=88382+56424

Subtask #9:

score: 17.1924
Acceptable Answer

Test #81:

score: 17.8615
Acceptable Answer
time: 910ms
memory: 6076kb

input:

9
574951428
15000 10000 200000 50000
5000
1781472251 1781466624
803445324 803444785
3544280892 3544283003
3151400420 3151403948
3250864128 3250871501
4189507543 4189510374
3483519516 3483520446
1003612935 1003617460
1101934749 1101931586
1948046579 1948042301
4151407804 4151401951
424123439 42412196...

output:

Succeeded
13986 10000 93490 58665
1671 4914
5978 9211
3457 8841
2006 4036
7513 9362
1180 3765
9212 9259
2367 133
1127 1264
1300 2380
8006 4494
9364 8505
3416 4767
2736 4699
6041 5538
9132 6644
3109 8519
319 1183
528 1775
1653 4838
1483 9230
7471 1043
9933 7936
4961 8760
4427 2452
669 3580
3593 7727
...

result:

points 0.66153822250 Accepted with 13986+10000 operations,sum of size(s)=93490+58665

Test #82:

score: 27
Accepted
time: 33ms
memory: 7140kb

input:

9
1015784000
15000 10000 200000 50000
4999
1230515063 1230515477
1648235686 1648236525
635002652 635000809
2658028480 2658040457
1408253592 1408238543
769202478 769200158
2523685577 2523682650
1538862073 1538856433
749934974 749934304
3127382239 3127383977
4154342134 4154335434
73346199 73343176
240...

output:

Succeeded
7148 9998 7440 14296
1098 1391
3881 2729
2969 932
2666 2301
9190 8137
7812 5119
9489 8282
7106 5657
7010 7999
8623 7972
6119 7776
6023 8023
9818 7473
9327 9433
6075 9604
7244 7170
5820 8933
7956 8317
5202 9314
9453 7218
8059 5651
9338 5942
9733 6382
7679 7868
8931 9250
6157 9865
8396 8619
...

result:

ok Accepted with 7148+9998 operations,sum of size(s)=7440+14296

Test #83:

score: 27
Accepted
time: 791ms
memory: 6252kb

input:

9
55817321
15000 10000 200000 50000
5000
1304134662 1304137877
4197466605 4197473870
3162827674 3162830057
741742835 741739475
2858391371 2858385511
3780001353 3779989619
3359702465 3359688510
3231387076 3231389835
3542793473 3542789123
3066772403 3066766651
1875041823 1875040807
2534345455 25343430...

output:

Succeeded
13625 10000 44124 34457
9669 6747
998 9644
9855 912
4567 7139
9814 5379
2736 4302
5615 6221
74 7593
4901 7064
5681 8969
1644 3328
9596 34
3986 326
9143 1766
6107 8449
1780 9169
6194 5788
3716 8537
8913 3683
3260 487
8561 2765
1170 8669
4060 5037
1257 1373
9204 3889
774 6779
4945 4776
9342 ...

result:

ok Accepted with 13625+10000 operations,sum of size(s)=44124+34457

Test #84:

score: 27
Accepted
time: 999ms
memory: 6108kb

input:

9
166393219
15000 10000 200000 50000
5000
2387124620 2387130367
1192773320 1192773098
2763055432 2763061802
849111984 849112355
1635031749 1635029798
1336542382 1336548437
3125990946 3125991620
4042871186 4042867438
4013879184 4013872960
149886626 149896462
354019436 354022814
3062987676 3062987592
...

output:

Succeeded
14341 10000 58360 42632
17 459
9569 4816
2035 2181
8046 2857
5268 7138
9542 9830
6693 6198
4468 6210
411 3079
5353 9589
9986 7014
9572 3141
6527 473
1437 6707
8682 5885
8845 8364
1424 2073
3219 2261
6239 7129
4698 7020
7895 8982
7292 135
9636 4644
6270 1078
7456 4972
260 472
3379 2627
3502...

result:

ok Accepted with 14341+10000 operations,sum of size(s)=58360+42632

Test #85:

score: 27
Accepted
time: 186ms
memory: 6292kb

input:

9
2023272264
15000 10000 200000 50000
4999
2666862814 2666858610
1075110989 1075112993
1120588648 1120591355
462044663 462038416
1789207962 1789200130
1044379505 1044378584
4181242805 4181236060
3740541105 3740536540
7426000 7423251
240646227 240645680
3295646628 3295657806
1238719994 1238717232
193...

output:

Succeeded
9440 9998 36348 30512
28 40
119 171
276 278
305 336
384 437
576 657
3107 834
801 843
930 939
1352 971
968 976
1173 1174
1242 1271
1289 1297
1380 1386
1484 1488
1495 1522
1567 1629
1740 1770
1791 1843
1895 1903
2015 2021
2103 2104
2154 2165
2216 2223
2235 2249
2277 2302
2396 2472
2560 2581
...

result:

ok Accepted with 9440+9998 operations,sum of size(s)=36348+30512

Test #86:

score: 27
Accepted
time: 148ms
memory: 6196kb

input:

9
1001789557
15000 10000 200000 50000
4999
2993900768 2993911387
4242927042 4242918648
1614558285 1614557906
1742595076 1742601302
2633784494 2633782949
58049529 58063585
1839417549 1839422075
3641885886 3641888995
4222704415 4222712528
2367129381 2367134322
801863126 801860103
3597714353 3597717099...

output:

Succeeded
10673 9998 37255 36814
44 333
358 359
504 584
636 874
932 1028
1244 1331
1455 1471
1649 1913
4951 2173
1990 2323
6 29
34 39
41 43
55 58
423 6028
66 72
75 78
97 100
103 104
114 120
129 140
155 162
182 183
187 230
242 248
258 265
276 283
293 310
312 321
342 344
362 381
384 398
408 415
433 44...

result:

ok Accepted with 10673+9998 operations,sum of size(s)=37255+36814

Test #87:

score: 27
Accepted
time: 181ms
memory: 6252kb

input:

9
157768064
15000 10000 200000 50000
5000
204641424 204643667
2330684444 2330678743
3612500362 3612500228
1025583801 1025581548
2577252381 2577258890
2861460971 2861463883
4223297569 4223295680
2356891898 2356892082
51639631 51640704
1628181782 1628184093
1087309069 1087308835
1500980657 1500981495
...

output:

Succeeded
10529 10000 45951 34311
13 98
215 291
303 331
351 360
375 396
415 418
456 600
37 607
66 149
177 310
762 883
948 1318
1396 1759
2017 2079
2122 2191
2403 2425
2482 2483
2592 2598
2887 2965
3120 3172
3329 3438
3869 3961
4038 4234
4285 4318
4567 4950
4981 5016
5182 5340
5510 5678
5745 5765
578...

result:

ok Accepted with 10529+10000 operations,sum of size(s)=45951+34311

Test #88:

score: 17.1924
Acceptable Answer
time: 950ms
memory: 5956kb

input:

9
1910293975
15000 10000 200000 50000
4998
289267748 289275041
917858779 917848068
3774441477 3774431277
4281286892 4281290209
450881121 450874816
1097210834 1097204019
1841904834 1841900810
3560440391 3560441328
1399494562 1399493396
1040535764 1040544860
4266745616 4266747425
877486823 877493892
3...

output:

Succeeded
13934 9996 95620 60203
3097 3496
378 2690
5156 8196
4909 7715
755 7648
1309 1380
1069 4131
5556 127
7847 9138
7750 9792
9407 4438
4259 2298
2627 4201
1882 1925
9778 6290
9795 2891
9444 5511
2843 9175
4985 254
2062 2070
5247 9629
5133 3170
3955 6667
7703 2940
9582 7407
9852 304
13 1111
2432...

result:

points 0.63675612090 Accepted with 13934+9996 operations,sum of size(s)=95620+60203

Test #89:

score: 27
Accepted
time: 476ms
memory: 6168kb

input:

9
1476673980
15000 10000 200000 50000
4999
387974521 387973579
4090605526 4090609432
2305798928 2305786545
2755224288 2755219131
590807156 590807358
1167115818 1167121758
4152334467 4152334979
412444727 412439395
171000664 171001218
1280685725 1280677572
3324105669 3324108253
35221841 35222123
10981...

output:

Succeeded
12507 9998 58722 39849
2 126
170 254
395 690
716 822
829 842
856 978
1048 1186
1340 1479
1679 1707
1723 1742
2035 2274
2516 2552
2635 2648
2755 2804
2853 2993
3806 3030
3270 3291
3308 3343
3518 3575
3691 3913
4059 4229
4399 4309
4678 4710
4832 4854
4968 5134
5155 5270
5274 5284
5344 5581
5...

result:

ok Accepted with 12507+9998 operations,sum of size(s)=58722+39849

Test #90:

score: 27
Accepted
time: 391ms
memory: 6156kb

input:

9
1290433813
15000 10000 200000 50000
4999
1479888307 1479891394
1589882388 1589877104
2251585022 2251581967
1090204205 1090203067
1606578815 1606575870
2804677664 2804675931
1108827585 1108828115
16271055 16274494
535723581 535713922
3804488080 3804481840
3120837039 3120834633
4202384962 4202386665...

output:

Succeeded
12006 9998 49306 34691
4652 3997
240 488
491 851
1876 2645
2796 3264
4294 407
1640 3244
8902 3561
3335 4115
4290 5072
5140 5206
5605 5874
6793 7251
9589 483
244 855
110 232
5639 9931
1447 4221
5005 9629
1096 6093
1382 8815
682 2285
9676 2316
4477 56
3149 419
6078 5138
50 63
197 249
452 840...

result:

ok Accepted with 12006+9998 operations,sum of size(s)=49306+34691

Test #91:

score: 27
Accepted
time: 386ms
memory: 6160kb

input:

9
18492853
15000 10000 200000 50000
5000
3666252811 3666249178
2329759832 2329770906
3517440155 3517433545
3854207928 3854206022
1387919291 1387920350
92486749 92482246
3042030069 3042033096
527999494 528005339
4036989518 4036991482
3817762306 3817759620
2463154564 2463160508
3355628429 3355630454
3...

output:

Succeeded
11577 10000 47517 34439
5122 1443
3696 9014
2514 9498
9623 5867
9989 3688
292 295
796 916
938 1032
1328 1579
1634 1838
214 250
319 411
561 589
639 738
790 836
1020 1030
1104 1113
9921 8147
8261 7284
3924 9026
6192 6704
9762 3043
164 9499
6030 6397
1666 4136
1936 5860
8197 6503
7492 9592
46...

result:

ok Accepted with 11577+10000 operations,sum of size(s)=47517+34439

Test #92:

score: 27
Accepted
time: 335ms
memory: 6404kb

input:

9
1308257742
15000 10000 200000 50000
4998
381070829 381068229
3231736638 3231742571
3564816540 3564818117
1534880820 1534878996
885304089 885297721
2902010232 2902003866
871072211 871078795
1322721005 1322719399
2493768993 2493768974
14560875 14556154
453293899 453292378
2079160779 2079161603
10489...

output:

Succeeded
9931 9996 84565 39834
5 9
10 17
22 29
36 42
46 51
55 56
57 62
63 72
77 81
84 86
87 94
95 101
102 106
114 115
123 124
125 126
127 128
129 131
134 136
138 139
141 142
153 155
167 175
181 183
193 197
201 202
203 204
208 209
212 213
225 227
229 230
231 233
237 238
239 243
253 254
255 260
262 2...

result:

ok Accepted with 9931+9996 operations,sum of size(s)=84565+39834

Test #93:

score: 27
Accepted
time: 332ms
memory: 6020kb

input:

9
652929959
15000 10000 200000 50000
5000
3847044414 3847043757
1285945202 1285943482
3636482240 3636483345
3221986728 3221984915
3250269937 3250266824
4130003768 4130001192
859846378 859841806
1528689337 1528691651
949713237 949714931
736092342 736092036
1349545195 1349549994
1579408136 1579407469
...

output:

Succeeded
8235 10000 89655 37005
22 42
64 83
90 100
101 114
122 124
156 198
220 226
236 245
246 247
266 274
296 304
306 314
323 325
330 333
342 355
369 380
393 400
404 461
463 507
520 523
537 566
572 614
623 624
626 628
634 663
709 737
803 827
836 838
841 880
881 893
898 911
952 953
969 974
977 1011...

result:

ok Accepted with 8235+10000 operations,sum of size(s)=89655+37005

Test #94:

score: 18.798
Acceptable Answer
time: 592ms
memory: 6064kb

input:

9
1409095588
15000 10000 200000 50000
4999
2945476315 2945474205
1573210229 1573213827
3850914021 3850917784
1423218803 1423213630
3465224232 3465227635
536020865 536030466
3782418736 3782419950
3487214117 3487217625
884504075 884505793
2736159505 2736154116
3239596796 3239604934
3807432148 38074355...

output:

Succeeded
14045 9998 86937 56560
1969 5358
3372 8331
3746 8584
4644 5886
951 6774
245 7599
2017 8892
4840 5436
213 6360
763 9348
8776 1522
2167 6325
4545 9985
2525 6996
5949 1115
7883 3618
2151 4369
4767 9980
9438 4343
3751 8963
4874 9758
1782 8364
7708 1799
3089 7121
2793 9192
3635 4999
426 7808
39...

result:

points 0.696223360 Accepted with 14045+9998 operations,sum of size(s)=86937+56560

Test #95:

score: 18.6856
Acceptable Answer
time: 591ms
memory: 6092kb

input:

9
642285867
15000 10000 200000 50000
5000
1271535928 1271529857
851118377 851123039
1707021255 1707032052
3532556861 3532570332
2212001695 2211998387
4163719159 4163726444
4252859744 4252854313
1384229157 1384230193
45363269 45364808
1415840536 1415844188
3628024026 3628031329
3742090293 3742096965
...

output:

Succeeded
14068 10000 87578 56810
2966 8595
3099 9188
2028 5894
3244 9854
3785 9906
1044 7427
2267 5188
2574 6914
4937 7030
360 7344
1649 5584
2244 6910
3538 7491
2256 6052
2229 5523
2893 7070
2828 2411
7363 3019
4678 5702
3570 6068
3232 9939
9160 4749
969 2406
4002 7920
7045 3011
4099 5721
3592 676...

result:

points 0.692057610 Accepted with 14068+10000 operations,sum of size(s)=87578+56810