QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#369253#7791. 通道建设 Passage Constructionzhouhuanyi92.1393 1436ms8272kbC++232.9kb2024-03-27 22:34:402024-03-27 22:34:42

Judging History

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

  • [2024-03-27 22:34:42]
  • 评测
  • 测评结果:92.1393
  • 用时:1436ms
  • 内存:8272kb
  • [2024-03-27 22:34:40]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<random>
#include"passageconstruction.h"
#define SN 10000
using namespace std;
mt19937 RAND(random_device{}());
const int inf=(int)(1e9);
int n,rt,smz,minn,dfn[SN+1],sz[SN+1],leng,ps[SN+1],depth[SN+1];
bool used[SN+1],vis[SN+1],vst[SN+1];
vector<int>E[SN+1];
vector<int>ES[SN+1];
vector<int>sp[SN+1];
vector<int>p[SN+1];
vector<int>tans;
vector<pair<int,int> >ans;
void add_edge(int x,int y)
{
	ES[x].push_back(y),ES[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],shuffle(E[x].begin(),E[x].end(),RAND);
	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>>&ES)
{
	n=N;
	int res=0;
	for (int i=1;i<=(n<<1);++i) depth[i]=GetDistance(1,i),res=max(res,depth[i]);
	for (int i=0;i<ES.size();++i)
	{
		if (depth[ES[i].first]+1==depth[ES[i].second]) E[ES[i].first].push_back(ES[i].second),used[ES[i].second]=1;
		if (depth[ES[i].second]+1==depth[ES[i].first]) E[ES[i].second].push_back(ES[i].first),used[ES[i].first]=1;
	}
	for (int i=1;i<=(n<<1);++i)
	{
		sp[depth[i]].push_back(i);
		if (!used[i]) p[depth[i]].push_back(i);
	}
	for (int i=1;i<=res;++i) solve(sp[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: 0ms
memory: 3732kb

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: 6012kb

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

result:

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

Test #3:

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

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: 3968kb

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: 3760kb

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: 1ms
memory: 5980kb

input:

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

output:

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

result:

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

Test #7:

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

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

result:

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

Test #8:

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

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

result:

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

Test #9:

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

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

result:

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

Test #10:

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

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

result:

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

Subtask #2:

score: 6
Accepted

Test #11:

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

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
179 200 484 494
70 97
79 65
173 138
145 6
121 198
76 20
57 163
71 13
170 18
83 175
127 174
16 2
156 7
111 36
161 11
96 106
38 72
167 73
197 12
105 129
100 48
148 26
179 169
51 132
152 108
136 188
104 168
190 140
185 160
159 186
172 143
199 118
125 123
3 103
113 81
4 89
40 34
101 52
176 196...

result:

ok Accepted with 179+200 operations,sum of size(s)=484+494

Test #12:

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

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
196 196 559 566
82 122
13 136
113 91
96 101
148 49
65 159
120 151
72 130
92 144
14 61
141 39
23 36
191 78
55 128
28 150
17 33
99 5
63 68
179 42
111 169
145 176
40 187
81 121
62 18
30 73
2 98
3 196
172 110
181 177
34 87
170 43
146 154
70 149
195 97
27 89
155 164
140 157
21 118
24 134
15 95
...

result:

ok Accepted with 196+196 operations,sum of size(s)=559+566

Test #13:

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

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
174 198 506 501
164 147
100 163
131 77
140 32
185 99
31 13
69 132
47 96
133 156
143 139
122 119
175 115
141 137
59 113
191 8
87 33
28 134
39 53
97 127
79 22
3 157
82 68
63 41
14 20
34 72
60 50
11 88
5 38
93 86
29 23
151 154
2 187
15 66
24 78
95 61
25 44
128 145
103 144
170 169
65 91
177 17...

result:

ok Accepted with 174+198 operations,sum of size(s)=506+501

Test #14:

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

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
170 198 470 497
93 168
193 173
51 149
3 195
137 139
162 126
181 94
48 86
144 121
42 166
65 188
23 38
61 110
11 67
58 70
124 75
156 68
74 12
131 185
171 95
128 127
170 154
106 63
43 13
24 84
52 107
2 179
20 169
54 91
100 186
14 62
159 28
152 16
9 99
176 172
114 83
143 192
73 78
53 146
39 60...

result:

ok Accepted with 170+198 operations,sum of size(s)=470+497

Test #15:

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

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
190 200 526 534
6 56
26 199
152 149
53 29
172 83
44 68
190 147
181 153
168 119
116 129
173 130
175 136
101 120
164 140
121 144
160 200
106 138
118 113
154 7
22 155
126 158
187 183
115 146
125 166
103 198
105 143
189 91
185 137
191 18
5 3
165 89
48 33
139 62
25 135
74 196
65 84
131 67
98 43...

result:

ok Accepted with 190+200 operations,sum of size(s)=526+534

Test #16:

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

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
188 200 499 519
8 38
94 105
126 43
146 111
13 166
193 84
36 131
140 91
147 52
132 149
156 17
45 82
200 11
117 130
99 185
165 78
77 81
171 153
2 47
155 175
142 116
123 103
148 73
96 170
58 68
124 184
179 110
174 120
199 159
198 107
145 127
167 114
182 150
195 10
88 42
181 63
137 95
74 22
17...

result:

ok Accepted with 188+200 operations,sum of size(s)=499+519

Test #17:

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

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
189 194 526 528
146 53
13 149
152 67
171 59
119 61
173 126
64 124
139 131
24 74
108 15
186 52
90 188
23 7
161 93
38 47
177 55
78 147
11 27
71 129
154 151
12 34
170 169
175 134
180 190
106 167
35 14
26 104
168 37
20 105
83 116
113 86
42 185
140 41
65 107
181 194
103 80
60 192
89 51
19 137
1...

result:

ok Accepted with 189+194 operations,sum of size(s)=526+528

Test #18:

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

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
184 196 498 513
195 124
96 82
59 188
69 105
122 189
85 52
37 114
98 73
43 120
74 68
86 163
126 42
34 107
32 40
160 138
87 176
78 55
28 25
121 84
50 18
103 129
20 136
146 10
7 148
141 142
102 135
60 117
147 30
76 111
97 17
19 11
6 51
38 27
80 156
88 53
3 192
46 57
134 45
62 72
178 183
149 9...

result:

ok Accepted with 184+196 operations,sum of size(s)=498+513

Subtask #3:

score: 8
Accepted

Test #19:

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

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
584 2000 584 1168
1740 1003
1560 1938
1246 1780
1573 1476
1826 1535
1031 1618
1661 1100
1527 1892
1660 1591
1354 1792
1594 1117
1097 1519
1919 1341
1846 1160
1853 1548
1863 1016
1445 1241
1481 1207
1371 1103
1646 1779
1329 1435
1162 1515
1342 1464
1756 1040
1383 1416
1724 1301
1061 1382
11...

result:

ok Accepted with 584+2000 operations,sum of size(s)=584+1168

Test #20:

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

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
20 1998 20 40
198 827
112 795
703 616
809 427
584 743
818 611
649 805
42 438
1863 330
1562 251
922 322
1460 130
723 928
868 579
606 701
641 761
711 339
60 786
581 237
759 256
502 651
634 368
1878 340
491 118
1638 924
6 411
437 224
529 484
728 346
13 1690
49 468
103 745
485 897
149 86
913 8...

result:

ok Accepted with 20+1998 operations,sum of size(s)=20+40

Test #21:

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

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
645 1996 645 1290
1947 1484
1581 1267
1561 1375
1992 1379
1868 1655
1545 1678
1945 1279
1478 1065
1965 1553
1953 1368
1682 1835
1823 1176
1376 1063
1411 1073
1284 1816
1912 1362
1165 1483
1815 1640
1177 1703
1534 1230
1185 1338
1742 1322
1957 1936
1528 1594
1693 1210
1764 1852
1071 1979
10...

result:

ok Accepted with 645+1996 operations,sum of size(s)=645+1290

Test #22:

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

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
332 1996 332 664
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 332+1996 operations,sum of size(s)=332+664

Test #23:

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

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
426 2000 426 852
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
1...

result:

ok Accepted with 426+2000 operations,sum of size(s)=426+852

Test #24:

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

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
180 1998 180 360
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 180+1998 operations,sum of size(s)=180+360

Test #25:

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

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
9 1996 9 18
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
75 ...

result:

ok Accepted with 9+1996 operations,sum of size(s)=9+18

Test #26:

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

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
952 1998 952 1904
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
86...

result:

ok Accepted with 952+1998 operations,sum of size(s)=952+1904

Test #27:

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

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
55 1998 55 110
96 486
1192 715
312 589
107 967
316 566
1406 1741
758 276
1743 283
449 762
466 189
72 30
428 376
596 26
868 235
430 208
152 638
612 341
1629 1289
1249 893
698 198
77 574
919 981
147 711
739 491
1910 773
229 1475
1960 584
274 1345
658 369
382 587
313 945
937 957
130 468
645 6...

result:

ok Accepted with 55+1998 operations,sum of size(s)=55+110

Test #28:

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

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
176 2000 176 352
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 176+2000 operations,sum of size(s)=176+352

Subtask #4:

score: 9
Accepted

Test #29:

score: 9
Accepted
time: 47ms
memory: 4332kb

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
1821 2000 6783 7198
1469 1834
1100 1286
978 395
1810 1022
1628 259
1201 273
610 429
69 126
1742 1772
1844 534
1379 1427
733 622
837 920
950 827
1005 1605
1045 1961
1766 1463
1852 1056
1126 375
820 787
202 885
692 162
39 1135
506 146
1063 1195
1071 1602
1146 571
1262 1957
1795 1040
320 650
...

result:

ok Accepted with 1821+2000 operations,sum of size(s)=6783+7198

Test #30:

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

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
1576 2000 4678 4677
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 1576+2000 operations,sum of size(s)=4678+4677

Test #31:

score: 9
Accepted
time: 51ms
memory: 4160kb

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
1828 1996 6898 7236
1196 1582
1663 1659
1119 1543
1745 1479
131 146
1864 298
1146 1847
1510 1802
915 321
1617 1730
1148 55
1036 560
90 681
1032 1013
1561 430
40 747
692 589
1816 1653
1757 1086
1751 1709
1371 998
1614 72
49 402
1698 1021
1528 1768
447 534
1704 1670
1485 1534
1051 1233
188 3...

result:

ok Accepted with 1828+1996 operations,sum of size(s)=6898+7236

Test #32:

score: 9
Accepted
time: 47ms
memory: 4248kb

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
1872 1996 7207 7635
1364 152
289 17
114 239
1718 1185
1804 342
1965 1670
1587 1466
1888 1391
1757 1532
1654 1166
1223 915
1529 849
419 468
1422 1194
1617 991
988 698
574 657
1789 1935
1444 1099
1944 1883
1575 864
404 376
1762 1626
1728 561
11 89
1433 242
1216 1994
1060 189
588 473
1372 159...

result:

ok Accepted with 1872+1996 operations,sum of size(s)=7207+7635

Test #33:

score: 9
Accepted
time: 52ms
memory: 4440kb

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
1837 1996 6900 7180
1712 1991
1805 1968
186 463
1707 1128
1525 1142
1486 1431
1603 241
1370 1233
1709 1762
102 1311
1497 1358
1129 1345
433 431
212 13
1950 1598
552 218
1426 814
60 454
1022 652
708 1183
214 443
1078 1219
1914 109
1502 1570
1033 1286
239 310
545 255
1695 1408
1312 411
1375 ...

result:

ok Accepted with 1837+1996 operations,sum of size(s)=6900+7180

Test #34:

score: 9
Accepted
time: 39ms
memory: 4496kb

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
1691 2000 7595 7072
1030 1241
1738 8
1943 703
1586 1809
662 310
883 765
855 165
1761 1919
1177 1284
1046 1701
424 931
807 257
1230 1334
552 318
1029 1746
1049 1262
1406 1069
1990 1366
1841 1102
1840 1101
1434 1622
853 410
475 557
249 604
1448 259
46 762
1603 1423
1510 917
1577 1339
1407 13...

result:

ok Accepted with 1691+2000 operations,sum of size(s)=7595+7072

Test #35:

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

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
1689 2000 7753 7223
1814 1796
246 138
1628 812
33 564
1794 1611
1045 326
592 939
1240 1835
1787 1894
1345 1374
1646 842
1779 1342
1294 572
1067 1595
1888 1107
1200 1108
1518 76
485 132
688 760
618 116
914 25
1608 1233
1129 919
168 650
473 502
1314 1380
1004 261
156 166
1992 114
413 734
469...

result:

ok Accepted with 1689+2000 operations,sum of size(s)=7753+7223

Test #36:

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

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
1682 2000 7644 7062
1974 1187
1691 1681
307 313
1384 1298
1880 1639
872 84
69 346
1582 1627
1206 687
1493 501
1144 128
1289 351
11 714
837 235
1107 398
1946 1357
1195 1575
1396 1962
737 832
1305 1411
1471 597
585 632
1794 1156
1579 103
1405 1574
1916 903
1602 1127
1862 1374
1985 1893
1773 ...

result:

ok Accepted with 1682+2000 operations,sum of size(s)=7644+7062

Test #37:

score: 9
Accepted
time: 27ms
memory: 4416kb

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
1256 2000 1634 2533
1408 1065
1877 1538
1356 1370
1102 1155
1227 914
1177 1337
1961 176
1077 1809
1396 1686
1220 1706
1406 1828
1320 1566
1951 1890
1035 1380
1871 1018
1759 1577
1027 462
1810 1088
1590 1850
1097 1355
1407 1338
1195 1309
1887 181
1724 1616
1833 1632
1528 1485
1752 1716
1771...

result:

ok Accepted with 1256+2000 operations,sum of size(s)=1634+2533

Test #38:

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

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
1316 1996 1800 2671
1566 612
1775 1623
1220 1114
1268 716
1538 1973
1810 1909
1031 1595
1700 1543
1611 1649
1065 1348
1944 1233
1880 1827
1797 1068
1812 1825
1298 1505
1763 1540
1741 1891
1007 1159
1244 1770
1630 734
1795 1398
1481 29
1084 1325
1346 1373
1916 1813
1755 1338
1516 1283
1336 ...

result:

ok Accepted with 1316+1996 operations,sum of size(s)=1800+2671

Subtask #5:

score: 11
Accepted

Test #39:

score: 11
Accepted
time: 49ms
memory: 4192kb

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
2027 1996 8139 7732
494 1362
123 679
1007 1071
1636 306
797 1115
906 1975
741 1248
1659 1830
273 1413
407 576
1941 199
1490 80
730 727
695 304
814 41
231 1314
81 1562
925 7
897 58
1740 1964
1094 1199
173 126
383 198
202 1701
747 707
125 1748
781 767
1974 1030
185 390
1229 1434
438 308
1245...

result:

ok Accepted with 2027+1996 operations,sum of size(s)=8139+7732

Test #40:

score: 11
Accepted
time: 41ms
memory: 4360kb

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
2225 1998 6449 5977
935 1787
8 604
510 10
1017 1621
1769 1526
1589 788
1570 251
793 981
1857 1422
483 726
1933 1246
1843 1670
138 882
938 154
1935 255
1777 1774
666 81
387 1528
530 1831
586 50
567 1618
743 673
1519 623
1588 1360
953 1824
1571 1760
160 829
1727 335
847 1766
896 12
1241 1852...

result:

ok Accepted with 2225+1998 operations,sum of size(s)=6449+5977

Test #41:

score: 11
Accepted
time: 19ms
memory: 6068kb

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
1524 2000 2204 3111
181 1860
1092 1375
58 1298
1436 1962
1154 1513
1976 1097
1050 519
1193 61
233 1579
1411 1815
363 1857
1858 1265
1573 1336
1974 1264
1897 1277
1787 1565
1382 1742
1759 183
1220 1924
722 1188
1393 1532
1006 1330
1061 1916
1617 1049
343 1064
1134 1147
296 1813
1863 1738
18...

result:

ok Accepted with 1524+2000 operations,sum of size(s)=2204+3111

Test #42:

score: 11
Accepted
time: 46ms
memory: 4264kb

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
2050 1998 8157 7958
576 1755
1976 792
560 130
1297 1223
501 975
1305 706
664 928
1646 1468
1072 1255
1705 1532
1287 275
846 1838
1846 378
1385 233
601 1848
10 455
1513 683
411 1336
1712 1623
1378 1939
1782 1786
1044 1741
1584 1978
1213 1416
1935 1662
1954 1494
1749 1502
1573 1904
1352 1546...

result:

ok Accepted with 2050+1998 operations,sum of size(s)=8157+7958

Test #43:

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

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
2061 1998 8090 7690
1440 785
11 1173
1196 126
1135 395
784 422
1945 1889
1973 426
612 526
645 1867
1561 1897
1277 1054
1001 1582
1458 469
203 539
456 1248
1022 1651
792 968
1955 1545
1645 1406
58 675
432 1919
1315 394
60 342
487 1793
918 1824
1065 63
1692 1087
757 417
1379 1927
1848 946
26...

result:

ok Accepted with 2061+1998 operations,sum of size(s)=8090+7690

Test #44:

score: 11
Accepted
time: 49ms
memory: 4488kb

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
2040 2000 8000 7516
818 1998
162 498
844 373
680 689
778 1906
974 936
146 811
1591 802
703 1064
449 634
305 181
301 1153
741 97
322 1386
1911 518
893 958
348 1507
446 177
224 870
1565 995
389 773
1057 845
491 149
980 203
260 497
328 13
612 4
294 770
1478 713
252 195
912 61
1735 24
1926 946...

result:

ok Accepted with 2040+2000 operations,sum of size(s)=8000+7516

Test #45:

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

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
621 2000 621 1242
1551 1171
1879 1323
1027 1452
1185 1414
1513 1943
1794 1775
1356 1799
1703 1803
1476 1228
1041 1327
1853 1674
1366 1595
1809 1326
1539 1899
1549 1436
1813 1328
1723 1147
1747 1206
1804 1043
1375 1756
1462 1096
1573 1529
1754 1307
1428 1415
1504 1969
1710 1220
1240 1212
11...

result:

ok Accepted with 621+2000 operations,sum of size(s)=621+1242

Test #46:

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

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
1406 1998 1406 2812
1083 91
1061 1097
770 36
1756 727
263 1594
1413 1941
790 1335
1014 1585
754 299
518 1988
1712 611
726 1017
1508 1330
372 987
1141 903
586 1885
1071 1533
1823 23
1672 111
334 967
1305 693
1476 936
1446 1750
612 1293
167 864
1130 759
856 465
1324 1110
1644 1603
69 1657
15...

result:

ok Accepted with 1406+1998 operations,sum of size(s)=1406+2812

Test #47:

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

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
6 2000 6 12
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 204...

result:

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

Test #48:

score: 11
Accepted
time: 23ms
memory: 4272kb

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
2728 2000 13068 8464
94 1604
911 1037
593 1139
110 1278
866 1411
514 1955
811 1443
36 1363
28 1420
257 1903
823 1996
329 1141
937 1687
833 1786
976 1906
967 1863
698 1355
271 1591
393 1533
174 1739
133 1892
659 1459
893 1828
566 1757
84 1610
521 1894
504 1123
396 1623
198 1088
636 1442
383...

result:

ok Accepted with 2728+2000 operations,sum of size(s)=13068+8464

Test #49:

score: 11
Accepted
time: 23ms
memory: 4276kb

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
2727 1998 13137 8476
647 1820
161 1100
552 1223
907 1405
228 1167
508 1630
682 1114
376 1301
315 1183
341 1993
580 1451
190 1634
723 1858
33 1923
278 1234
6 1958
976 1206
697 1124
913 1267
827 1407
175 1707
208 1565
245 1312
280 1369
193 1360
760 1551
336 1597
790 1219
520 1530
914 1014
12...

result:

ok Accepted with 2727+1998 operations,sum of size(s)=13137+8476

Subtask #6:

score: 12
Accepted

Test #50:

score: 12
Accepted
time: 56ms
memory: 4288kb

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
1847 1996 7181 7700
1863 1562
1041 1604
766 294
176 949
1152 100
1970 1035
416 1925
1833 344
162 1321
524 722
366 698
199 409
1600 1496
373 1630
1224 954
1862 633
1097 1052
1424 1522
307 461
1858 1921
1902 1947
904 1949
1588 87
213 760
49 998
177 234
1222 1385
825 145
1688 1256
1003 415
37...

result:

ok Accepted with 1847+1996 operations,sum of size(s)=7181+7700

Test #51:

score: 12
Accepted
time: 61ms
memory: 5988kb

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
1849 1998 7363 7856
1405 66
990 503
1799 1714
508 1191
227 82
1565 1053
1928 289
556 267
617 651
1047 1275
1539 1992
1164 836
841 998
1528 611
627 610
662 95
1894 1630
1463 86
1764 1662
602 873
692 905
1682 1794
1796 64
1587 172
1743 930
53 553
1226 179
1110 1173
1498 1781
1711 1780
354 89...

result:

ok Accepted with 1849+1998 operations,sum of size(s)=7363+7856

Test #52:

score: 12
Accepted
time: 27ms
memory: 4304kb

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
1487 2000 4784 4806
322 937
977 413
1326 1017
1318 1346
1718 569
1107 1519
1290 1312
432 553
26 428
360 423
635 140
549 630
190 405
441 48
424 87
1333 1422
1177 1057
1037 1502
1896 1698
910 86
690 258
476 388
378 831
1030 1050
112 163
559 361
667 694
922 292
1473 1317
1129 1216
1585 1062
1...

result:

ok Accepted with 1487+2000 operations,sum of size(s)=4784+4806

Test #53:

score: 12
Accepted
time: 22ms
memory: 4324kb

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
1358 1998 4041 4169
964 463
618 702
502 44
756 888
438 80
1209 1451
1532 924
755 581
815 750
555 752
66 885
148 588
873 788
205 535
278 146
1730 1787
1376 1011
1809 1590
1866 1088
1426 1223
1526 1017
1649 1537
1592 1959
1076 1799
1318 1233
1070 1197
1264 1536
1086 1657
1467 1917
1162 1278
...

result:

ok Accepted with 1358+1998 operations,sum of size(s)=4041+4169

Test #54:

score: 12
Accepted
time: 22ms
memory: 6032kb

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
1331 1996 4323 4431
656 703
619 219
62 677
1782 1262
1598 1551
1643 1692
1762 1398
1173 1065
1156 1680
1742 1496
1717 1259
1038 1745
1425 1124
1129 1217
1369 1414
1544 1083
1936 1413
1209 1733
1455 1478
1653 1572
1920 1972
1432 1528
1061 1509
1299 1041
1683 1433
1268 1773
1471 1626
1182 19...

result:

ok Accepted with 1331+1996 operations,sum of size(s)=4323+4431

Test #55:

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

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
1156 2000 3917 3585
1505 1610
1014 1076
1774 1441
1633 1253
1728 1665
1845 1406
1095 1196
1626 1994
1220 1257
1770 1756
1358 1202
1885 1298
1520 1697
1248 1562
1368 1748
1125 1444
1980 1931
1053 1332
1344 1413
1605 1574
1788 1915
1554 1959
1654 1183
1603 1924
1489 1279
1120 1456
1921 1832
...

result:

ok Accepted with 1156+2000 operations,sum of size(s)=3917+3585

Test #56:

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

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
1308 1996 3872 3815
1800 1372
1278 1853
1954 1749
1858 1713
1412 1180
1116 1247
1937 1335
1897 1329
1917 1854
1476 1625
1646 1354
1035 1090
1034 1240
1871 1031
1307 1232
1758 1922
1213 947
450 856
785 510
1454 1042
1914 1670
1340 1904
1856 1277
849 889
1990 1686
767 504
783 135
1368 1202
1...

result:

ok Accepted with 1308+1996 operations,sum of size(s)=3872+3815

Test #57:

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

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
1319 1998 6631 4510
302 335
626 474
543 251
529 643
781 472
366 282
83 777
952 340
201 245
341 189
563 478
999 164
896 38
123 544
607 514
720 228
577 877
87 415
647 116
8 946
456 545
273 106
199 642
585 721
715 629
977 888
324 358
186 956
804 714
52 158
812 880
64 50
481 236
73 102
82 344
...

result:

ok Accepted with 1319+1998 operations,sum of size(s)=6631+4510

Test #58:

score: 12
Accepted
time: 20ms
memory: 4180kb

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
1347 2000 6522 4426
667 592
439 223
698 353
576 681
841 876
752 562
345 591
311 99
240 20
751 898
642 689
64 310
453 551
673 93
198 257
957 256
956 469
451 705
105 935
299 433
659 401
569 567
290 827
863 506
772 716
16 552
855 675
115 152
280 330
717 329
143 372
776 347
671 250
969 102
482...

result:

ok Accepted with 1347+2000 operations,sum of size(s)=6522+4426

Subtask #7:

score: 14
Accepted

Test #59:

score: 14
Accepted
time: 56ms
memory: 4292kb

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
1928 2000 8012 7820
939 263
1483 393
1846 105
539 777
54 885
1338 752
840 1256
673 62
480 95
380 1073
1120 534
232 475
446 57
1735 1101
1051 1614
1013 1792
1486 1684
1098 1968
1603 1092
1050 1741
1942 45
546 714
1439 1949
1716 938
1390 1915
1192 1673
775 927
1826 587
1064 1021
1662 1834
14...

result:

ok Accepted with 1928+2000 operations,sum of size(s)=8012+7820

Test #60:

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

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
52 1998 52 104
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
1407 ...

result:

ok Accepted with 52+1998 operations,sum of size(s)=52+104

Test #61:

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

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
2199 2000 6250 5868
1857 307
392 256
853 922
198 1671
317 628
553 1622
823 820
905 1332
397 1699
1112 283
254 1832
1173 627
1951 1300
1345 1704
1688 810
1956 490
1250 889
1306 470
1412 422
1655 1960
1925 1268
1169 1314
1739 1773
1196 1533
1074 1770
1336 1805
1310 1228
792 1349
849 1229
165...

result:

ok Accepted with 2199+2000 operations,sum of size(s)=6250+5868

Test #62:

score: 14
Accepted
time: 55ms
memory: 4428kb

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
1936 1996 8797 8218
785 688
1945 1442
1504 671
656 1123
1965 942
197 1883
610 233
789 241
938 468
65 119
1214 331
1319 58
1941 1413
115 1450
1869 945
956 836
1466 1982
1680 1441
624 501
92 1960
1096 392
1321 1817
1078 575
1290 1848
446 415
1596 6
812 141
904 328
1345 1209
482 339
1786 720
...

result:

ok Accepted with 1936+1996 operations,sum of size(s)=8797+8218

Test #63:

score: 14
Accepted
time: 22ms
memory: 4256kb

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
1693 2000 5559 5641
1519 721
1302 1160
1443 908
1548 796
1486 21
605 1657
1479 1804
1862 264
258 1912
1465 463
967 1900
1315 1910
1436 927
498 1005
739 920
666 1490
1578 550
1612 1305
1506 1876
844 1309
1717 947
606 1349
472 1235
1316 1173
1791 1156
1215 130
436 600
494 1589
905 864
1621 1...

result:

ok Accepted with 1693+2000 operations,sum of size(s)=5559+5641

Test #64:

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

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
1651 1998 4313 4566
1068 470
33 634
1863 531
1288 373
640 1357
393 1650
132 1177
1589 667
998 1186
1302 650
1516 675
1057 1076
1776 704
240 1622
905 1452
297 474
1900 184
653 1553
1983 136
1233 1529
1762 1304
107 941
415 1024
1000 138
1412 416
1232 529
175 651
1932 1264
54 327
961 520
1106...

result:

ok Accepted with 1651+1998 operations,sum of size(s)=4313+4566

Test #65:

score: 14
Accepted
time: 18ms
memory: 4524kb

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
1612 1998 3891 4458
652 1544
277 197
444 670
1465 624
1637 67
759 371
1143 1243
88 1698
1977 374
578 1956
401 1286
117 1279
1008 1631
750 1884
563 378
1160 510
1507 902
1966 1954
276 1094
335 1297
231 218
1972 1505
1555 1704
806 568
1254 1099
1588 1801
1978 720
647 1750
1506 127
215 1627
1...

result:

ok Accepted with 1612+1998 operations,sum of size(s)=3891+4458

Test #66:

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

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
1357 1998 6573 4503
969 258
642 662
356 160
460 237
611 909
859 440
465 73
614 801
663 422
564 103
826 170
113 593
728 56
532 818
162 64
50 92
702 484
283 527
68 346
834 914
777 262
401 343
684 190
326 349
110 57
273 214
296 15
137 192
599 448
653 315
82 203
887 188
398 429
781 199
337 821...

result:

ok Accepted with 1357+1998 operations,sum of size(s)=6573+4503

Test #67:

score: 14
Accepted
time: 20ms
memory: 4460kb

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
1330 1998 6650 4467
530 913
574 807
54 881
703 197
621 529
846 563
679 59
74 539
327 424
519 713
220 393
542 98
501 815
317 4
35 470
237 173
436 989
947 982
797 843
785 246
513 715
868 883
769 435
632 420
502 942
999 569
882 295
606 129
345 663
961 742
591 562
168 729
675 488
747 278
22 75...

result:

ok Accepted with 1330+1998 operations,sum of size(s)=6650+4467

Test #68:

score: 14
Accepted
time: 23ms
memory: 4208kb

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
2722 1998 13085 8360
682 1444
639 1964
463 1387
324 1863
41 1080
183 1737
606 1543
399 1555
156 1416
101 1510
10 1764
524 1073
986 1513
70 1585
59 1415
549 1847
879 1142
750 1899
94 1275
792 1243
987 1792
998 1520
656 1306
586 1096
969 1382
186 1166
229 1071
92 1947
689 1881
96 1164
954 19...

result:

ok Accepted with 2722+1998 operations,sum of size(s)=13085+8360

Test #69:

score: 14
Accepted
time: 29ms
memory: 4284kb

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
2701 1996 12661 8739
955 1150
777 1801
1618 181
1177 633
435 1273
379 1104
522 1613
354 1830
762 1119
1492 746
1068 992
299 1954
211 1566
1412 989
36 1851
872 1993
877 1807
1344 580
953 1217
44 883
1722 21
822 1611
873 1047
436 1557
1987 251
1283 1906
734 1781
893 1882
729 649
1992 915
720...

result:

ok Accepted with 2701+1996 operations,sum of size(s)=12661+8739

Subtask #8:

score: 10
Accepted

Test #70:

score: 10
Accepted
time: 1436ms
memory: 6292kb

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
9882 9998 56430 52080
4696 5773
2570 712
6245 4292
438 7727
1028 584
6570 9316
2416 7626
3047 7029
3916 7057
6545 6979
9522 9104
1091 2873
1644 547
8 5576
2586 5388
9310 7055
2214 5068
8651 1474
2392 1846
8867 3124
1443 8636
274 4357
7874 7045
2362 1640
4430 2881
8031 4643
5338 2441
490 45...

result:

ok Accepted with 9882+9998 operations,sum of size(s)=56430+52080

Test #71:

score: 10
Accepted
time: 5ms
memory: 8272kb

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
258 9996 258 516
1113 3382
966 496
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
9153 9848
8960 7...

result:

ok Accepted with 258+9996 operations,sum of size(s)=258+516

Test #72:

score: 10
Accepted
time: 876ms
memory: 6304kb

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
11244 9998 32399 29958
1949 6626
6032 443
2789 5030
3105 3067
6601 5522
7031 8276
3633 3205
9117 8580
4437 2638
6380 23
516 2831
484 696
8380 9865
9099 6636
5251 6490
3455 6051
853 2769
9547 9822
7737 4786
6721 5589
7862 3662
9267 9250
4535 6431
8727 2460
8663 8840
2622 2285
6296 2655
4325...

result:

ok Accepted with 11244+9998 operations,sum of size(s)=32399+29958

Test #73:

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

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
9935 9998 57046 52570
1588 5999
7498 4425
5516 4999
6170 1661
7261 1404
2615 7808
8568 7941
5301 2391
6796 4438
7455 6009
794 1597
7640 9953
7491 7668
7905 4341
3168 9924
3297 8885
2553 3422
9683 6336
7651 960
8745 6189
9972 8514
5816 1855
4434 1925
7256 1804
1541 8095
6668 408
3440 1625
3...

result:

ok Accepted with 9935+9998 operations,sum of size(s)=57046+52570

Test #74:

score: 10
Accepted
time: 464ms
memory: 6192kb

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
8475 9996 37182 32476
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
5862 5482
931 6695
9252 3057
2995 4508
2925 9753
1470 7387
4485 7020
5220 2635
3710 4830
1238 8237
7705 6137
3077 6512
9515 8581
1069 9794
8...

result:

ok Accepted with 8475+9996 operations,sum of size(s)=37182+32476

Test #75:

score: 10
Accepted
time: 513ms
memory: 6184kb

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
8921 9996 35773 31246
2077 5873
842 3882
9454 6676
7451 1604
5361 5933
5677 6437
5741 5052
6008 5134
8774 5165
7857 7907
7270 6852
7390 8499
5628 5870
6534 8690
6781 9053
9507 9835
7540 8278
9618 9109
5215 8136
8706 6067
9021 9759
7005 8845
8851 6697
6761 7371
8194 9244
3033 7215
5258 359
...

result:

ok Accepted with 8921+9996 operations,sum of size(s)=35773+31246

Test #76:

score: 10
Accepted
time: 427ms
memory: 6268kb

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
8228 9996 30864 28607
9931 4250
9413 1854
78 8723
2399 4013
1819 9100
3214 3781
8544 5894
7556 8350
2887 8725
1608 5424
6922 6340
4932 8328
1298 9541
7408 523
8861 1200
4157 2677
6546 7370
9564 4736
4161 1749
4665 1662
6836 7367
9225 1909
8367 5838
9724 5844
373 1483
1841 2819
6795 7438
78...

result:

ok Accepted with 8228+9996 operations,sum of size(s)=30864+28607

Test #77:

score: 10
Accepted
time: 445ms
memory: 6684kb

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
6884 9998 43757 27943
3463 1824
4153 3399
4518 2496
1357 211
1759 2362
1563 2495
3657 2915
1708 967
1403 4826
4680 1040
3838 2156
591 2809
831 3644
3595 130
1650 1362
4040 102
1745 4763
3340 3325
1814 3091
3903 1675
4254 4954
2926 2274
1769 4242
933 1271
1998 3130
3643 168
1877 1870
907 16...

result:

ok Accepted with 6884+9998 operations,sum of size(s)=43757+27943

Test #78:

score: 10
Accepted
time: 430ms
memory: 5996kb

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
6875 10000 41283 26468
4397 574
968 1454
3192 429
4827 1102
4646 2005
1048 1971
1329 2477
652 1237
853 4464
2632 4986
4726 2390
1157 1484
3315 4449
1306 1699
4915 4611
917 2012
3738 4949
1586 573
1052 2652
1965 1646
2074 476
2093 3215
4008 3355
3176 3806
72 3482
4814 89
4838 4770
2452 1958...

result:

ok Accepted with 6875+10000 operations,sum of size(s)=41283+26468

Test #79:

score: 10
Accepted
time: 598ms
memory: 6164kb

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
13771 9996 87471 54375
1670 6126
2204 6067
1795 6217
4400 8215
360 9678
1191 7845
302 6625
4915 9614
1498 6207
4233 9590
3891 8053
2762 5040
3988 7545
613 7853
354 7566
456 9989
1638 6737
421 7170
934 8730
655 5432
2828 6425
3566 6525
1144 5883
2682 7338
2380 9176
867 8774
7918 1153
5952 7...

result:

ok Accepted with 13771+9996 operations,sum of size(s)=87471+54375

Test #80:

score: 10
Accepted
time: 637ms
memory: 6220kb

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
13729 9998 86490 55040
3013 5495
2953 8607
919 5805
3955 6014
365 5530
1193 9450
4319 7815
596 9874
2026 7132
4814 9708
2603 8345
537 6550
4479 9364
1453 7721
1176 7121
458 6515
1694 7817
573 8762
892 6921
4496 9855
1507 5016
2821 5306
25 8485
4351 5172
702 6816
1803 5216
3678 5226
5905 34...

result:

ok Accepted with 13729+9998 operations,sum of size(s)=86490+55040

Subtask #9:

score: 19.1393
Acceptable Answer

Test #81:

score: 21.6668
Acceptable Answer
time: 1400ms
memory: 6056kb

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
9904 10000 54912 50419
5978 9211
1671 4914
3457 8841
7513 4036
9362 2006
5457 1300
6032 9052
8910 9242
300 1709
4772 6434
6411 6383
2280 845
9763 8071
7757 3900
5461 5198
2682 659
1058 4424
6921 7281
736 4926
1324 8088
4811 4505
4601 427
2013 6933
9863 2076
9288 1362
2068 5085
3894 865
641...

result:

points 0.80247555610 Accepted with 9904+10000 operations,sum of size(s)=54912+50419

Test #82:

score: 27
Accepted
time: 31ms
memory: 7608kb

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
2444 9998 2463 4888
4585 5430
1098 1391
3881 2729
2969 932
2666 2301
9123 3463
858 4716
8940 5156
9079 6393
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
97...

result:

ok Accepted with 2444+9998 operations,sum of size(s)=2463+4888

Test #83:

score: 27
Accepted
time: 883ms
memory: 6492kb

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
11160 10000 31730 29525
6412 6329
9847 1107
1362 3023
976 988
6885 2180
3549 165
4710 5076
5845 1463
2184 195
4948 7736
9396 452
8757 5419
1020 9545
2198 8146
5007 7645
7216 3277
6312 2753
9067 8018
933 4366
5570 2378
8153 2019
3206 8355
7528 6148
1132 639
8536 4209
5527 9884
920 6409
8679...

result:

ok Accepted with 11160+10000 operations,sum of size(s)=31730+29525

Test #84:

score: 27
Accepted
time: 1059ms
memory: 6256kb

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
11871 10000 43050 37692
6653 8489
7265 1050
1821 2348
2270 5106
3836 5351
9665 5586
6703 1259
858 3231
6617 2562
660 2932
5964 5389
9186 5937
7549 1986
5463 8356
4684 6518
7907 9687
6603 9799
9082 1011
68 1061
1763 9744
6600 3251
4817 7416
3903 934
4336 6032
8173 3313
3705 5419
838 8223
22...

result:

ok Accepted with 11871+10000 operations,sum of size(s)=43050+37692

Test #85:

score: 27
Accepted
time: 203ms
memory: 6416kb

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
6299 9998 21103 23827
5194 4331
3598 1522
5841 4112
3513 1567
6448 6666
7815 8869
278 1770
4411 9159
4108 2216
2672 5449
9222 9755
7844 2015
2848 7756
6396 2223
5927 8929
6571 6086
1843 3411
6472 5111
1740 801
6378 5185
5283 9383
8063 8365
8135 437
9048 9547
3148 4035
2981 3467
7003 6202
9...

result:

ok Accepted with 6299+9998 operations,sum of size(s)=21103+23827

Test #86:

score: 27
Accepted
time: 173ms
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
6947 9998 20980 27508
5452 3495
6773 7785
1244 5571
7434 8543
5679 636
5470 2323
1649 8237
7318 7967
5067 8268
8168 3445
9224 2579
1455 504
1628 981
8005 1660
3319 97
1595 4502
100 7238
8454 4172
6926 1736
9933 463
1262 5133
6690 916
265 3410
8323 9622
1765 6728
39 2993
7220 6671
5680 6767...

result:

ok Accepted with 6947+9998 operations,sum of size(s)=20980+27508

Test #87:

score: 27
Accepted
time: 208ms
memory: 7256kb

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
6528 10000 25207 24700
8083 7404
4251 6409
7210 2048
9022 6960
360 8082
8758 2980
2723 2528
5156 8079
9249 4044
9942 2890
456 8002
5753 6736
1444 687
4282 5353
5588 8096
3219 2594
8224 5851
2966 6392
5016 8062
4285 762
1318 66
5510 7054
3120 6854
948 7550
9108 7418
9678 5803
8174 4318
5678...

result:

ok Accepted with 6528+10000 operations,sum of size(s)=25207+24700

Test #88:

score: 21.0812
Acceptable Answer
time: 1421ms
memory: 6364kb

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
9932 9996 56319 51638
5156 8196
4909 7715
755 7648
3496 3097
378 2690
1380 1309
1069 4131
1406 1971
2232 2747
2627 4201
7750 9792
5556 127
7847 9138
9407 4438
4259 2298
1882 1925
4058 1395
7824 2044
6508 7402
5860 2786
4961 6991
2958 4391
6437 6819
9109 4284
4826 3980
7719 1028
5026 4161
8...

result:

points 0.78078430440 Accepted with 9932+9996 operations,sum of size(s)=56319+51638

Test #89:

score: 27
Accepted
time: 557ms
memory: 6176kb

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
9164 9998 36534 32757
9100 5528
3415 7313
2256 1617
750 8542
492 8200
2700 13
5003 2236
2936 7375
4292 1170
5514 9806
9106 1840
1910 8139
9062 2458
6249 8585
4458 5253
9663 9639
2784 1402
5172 9247
4133 5173
9376 7546
8 4791
7133 6107
8068 2470
3390 5170
5640 4928
3722 937
585 5273
8734 80...

result:

ok Accepted with 9164+9998 operations,sum of size(s)=36534+32757

Test #90:

score: 27
Accepted
time: 430ms
memory: 7172kb

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
8563 9998 30231 27502
4290 5140
5206 5072
4294 407
1640 3244
8902 3561
5605 2796
7251 9589
3264 1876
6793 5874
3335 851
4115 240
2645 488
491 483
4652 3997
855 244
110 232
264 8527
8798 5630
4687 4440
8475 124
7635 5017
5412 2368
2969 6219
2267 2378
7838 9005
6857 3607
411 8903
9432 8371
8...

result:

ok Accepted with 8563+9998 operations,sum of size(s)=30231+27502

Test #91:

score: 27
Accepted
time: 426ms
memory: 6184kb

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
8236 10000 28667 26830
5122 1443
3696 9014
2514 9498
9623 5867
9989 3688
3036 6339
6792 4279
3938 5937
6748 6073
985 3482
1027 1321
1890 1438
97 1188
5289 7685
3636 2239
7475 6708
8461 2342
6877 845
9763 106
1887 557
2062 5746
1322 3171
3127 4809
4345 538
9201 6899
3705 6335
3726 2713
2898...

result:

ok Accepted with 8236+10000 operations,sum of size(s)=28667+26830

Test #92:

score: 27
Accepted
time: 459ms
memory: 6764kb

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
6843 9996 44585 28445
3408 2657
3996 4123
2841 1709
1033 4834
5 2589
872 1604
4247 509
742 127
4134 1430
4178 869
4498 618
2519 2012
1098 243
4582 753
3161 4773
466 1188
3678 101
886 1870
1279 3820
2187 567
2048 2453
2564 1050
2399 4481
2055 4906
4817 2054
2315 1827
124 4226
3905 3932
4808...

result:

ok Accepted with 6843+9996 operations,sum of size(s)=44585+28445

Test #93:

score: 27
Accepted
time: 450ms
memory: 6028kb

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
6949 10000 44511 28451
841 3824
1793 4069
4967 4269
836 3958
4559 2712
3125 4870
380 2574
3409 3322
1421 2016
1015 2489
1248 42
3930 3685
1465 3581
4732 626
4739 893
3960 2186
2552 122
3728 4244
2910 1384
2310 1842
881 2266
4921 1402
342 3659
507 2589
3131 1124
3093 1879
4205 325
186 4216
...

result:

ok Accepted with 6949+10000 operations,sum of size(s)=44511+28451

Test #94:

score: 19.4323
Acceptable Answer
time: 639ms
memory: 6444kb

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
13726 9998 85461 55164
1969 5358
435 6646
891 5844
320 6003
2756 8273
2635 6096
2596 6124
2269 7306
213 6360
763 9348
8776 1522
2167 6325
4545 9985
2525 6996
5949 1115
3372 8331
3746 8584
4644 5886
245 7599
951 6774
2017 8892
4840 5436
7883 3618
621 7302
1134 9303
4596 9066
4429 5248
1066 ...

result:

points 0.71971468960 Accepted with 13726+9998 operations,sum of size(s)=85461+55164

Test #95:

score: 19.1393
Acceptable Answer
time: 634ms
memory: 6220kb

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
13791 10000 86352 55806
1386 7158
2401 9582
1530 9417
3548 9258
3317 5269
3794 9709
322 6313
2898 7476
4284 919
6608 3669
3605 7027
4439 6809
4841 7556
7870 2195
7225 602
1586 9781
663 5112
2990 6649
3576 2383
714 7692
1757 8583
1585 5355
4225 8678
4954 9630
78 6535
4362 9779
363 5026
2858...

result:

points 0.70886296360 Accepted with 13791+10000 operations,sum of size(s)=86352+55806