QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#32863#1174. Lights On The RoadWu_RenAC ✓201ms110736kbC++171.6kb2022-05-25 10:05:062022-05-25 10:05:06

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-25 10:05:06]
  • Judged
  • Verdict: AC
  • Time: 201ms
  • Memory: 110736kb
  • [2022-05-25 10:05:06]
  • Submitted

answer

#include <bits/stdc++.h>
#define fi first
#define se second
typedef long long ll;
const ll inf=1e18;
using namespace std;
int T,n,K,fa[250010],cnt=0,rt[250010],a[250010];
ll dis[250010];
bool vis[250010];
struct heap{
	int lc,rc,len,id;
	ll w;
}tr[6000000];
struct node{
	int id;
	ll w;
	bool operator <(const node &b)const{
		return w>b.w;
	}
};
priority_queue<node>q;
int newnode(ll w,int id){
	tr[++cnt]=(heap){0,0,1,id,w};
	return cnt;
}
void mge(int &x,int y){
	if(!x||!y) return x=x^y,void();
	if(tr[x].w>tr[y].w) swap(x,y);
	int id=++cnt;
	tr[id]=tr[x],mge(tr[id].rc,y);
	if(tr[tr[id].lc].len<tr[tr[id].rc].len) swap(tr[id].lc,tr[id].rc);
	tr[id].len=tr[tr[id].rc].len+1;
	x=id;
}
ll nxt(){
	if(q.empty()) return inf;
	int id=q.top().id;
	ll w=q.top().w;
	q.pop();
	if(tr[id].lc) q.push({tr[id].lc,w-tr[id].w+tr[tr[id].lc].w});
	if(tr[id].rc) q.push({tr[id].rc,w-tr[id].w+tr[tr[id].rc].w});
	if(rt[tr[id].id]) q.push({rt[tr[id].id],w+tr[rt[tr[id].id]].w});
	return w;
}
void out(ll fi){
	if(K--) printf("%lld\n",fi);
	if(K>0) while(K--){
		ll w=nxt();
		if(w<inf) printf("%lld\n",fi+w);
		else puts("-1");
	}
}
int main(){
	scanf("%d%d",&n,&K),n+=2;
	for(int i=2;i<n;i++) scanf("%d",&a[i]);
	if(n==3) out(a[2]),exit(0);
	dis[n]=0;
	for(int i=n-1;i>=1;i--){
		int l=i+1,r=min(i+3-(i==1||i==n-3),n);
		pair<ll,int>tp;tp.fi=inf;
		for(int j=l;j<=r;j++) tp=min(tp,{dis[j],j});
		dis[i]=tp.fi+a[i],fa[i]=tp.se;
		for(int j=l;j<=r;j++) if(j^fa[i]) mge(rt[i],newnode(dis[j]+a[i]-dis[i],j));
	}
	for(int i=n-1;i>=1;i--) mge(rt[i],rt[fa[i]]);
	if(rt[1]) q.push((node){rt[1],tr[rt[1]].w});
	out(dis[1]);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 3
1 3 10 3 1

output:

4
4
5

result:

ok 3 tokens

Test #2:

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

input:

12 1
317 448 258 208 284 248 315 367 562 500 426 390

output:

1525

result:

ok "1525"

Test #3:

score: 0
Accepted
time: 2ms
memory: 7904kb

input:

12 20
317 448 258 208 284 248 315 367 562 500 426 390

output:

1525
1566
1602
1616
1633
1652
1697
1725
1730
1733
1747
1761
1764
1766
1773
1775
1783
1792
1811
1824

result:

ok 20 tokens

Test #4:

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

input:

3 9
0 0 0

output:

0
0
0
0
0
-1
-1
-1
-1

result:

ok 9 tokens

Test #5:

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

input:

2 9
1 100

output:

1
100
101
-1
-1
-1
-1
-1
-1

result:

ok 9 tokens

Test #6:

score: 0
Accepted
time: 2ms
memory: 7772kb

input:

3 100
1 1000000000 1

output:

2
1000000000
1000000001
1000000001
1000000002
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

result:

ok 100 tokens

Test #7:

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

input:

2 9
100 1

output:

1
100
101
-1
-1
-1
-1
-1
-1

result:

ok 9 tokens

Test #8:

score: 0
Accepted
time: 2ms
memory: 7848kb

input:

4 100
1 1000000000 1000000000 1

output:

2
1000000001
1000000001
1000000002
1000000002
2000000000
2000000001
2000000001
2000000002
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100 tokens

Test #9:

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

input:

5 100
1 1000000000 1000000000 1000000000 1

output:

1000000001
1000000001
1000000002
1000000002
1000000002
2000000000
2000000001
2000000001
2000000001
2000000001
2000000002
2000000002
2000000002
3000000000
3000000001
3000000001
3000000002
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

result:

ok 100 tokens

Test #10:

score: 0
Accepted
time: 17ms
memory: 7924kb

input:

16 250000
905723539 90306910 457876784 855484770 577774383 922814671 518111606 102941447 849328825 901093759 737564920 681510001 472346401 410959735 910390182 572749956

output:

2492297351
2553684017
2717212856
2829937577
2891324243
2950174135
2964643752
3010408957
3011560801
3054853082
3071795623
3100487843
3128172591
3132383015
3173807352
3175089640
3212251748
3235194018
3235324462
3264016682
3285571257
3287814361
3288119344
3295214423
3302283978
3337336191
3341626176
334...

result:

ok 250000 tokens

Test #11:

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

input:

17 250000
996869741 484246471 280346666 697749553 506126664 771052456 761981652 199453063 627310372 535366183 145915390 593867285 760912348 298547623 744415016 145552572 654915955

output:

1779841783
2060188449
2242206508
2289205166
2315207966
2325114241
2373709068
2407152155
2434757738
2477591336
2522553174
2524256799
2540754131
2541823435
2550894239
2569551832
2572811719
2595554632
2631657301
2654055734
2687498821
2715104404
2733446324
2742517128
2752971550
2757938002
2763159861
277...

result:

ok 250000 tokens

Test #12:

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

input:

18 250000
14387014 509589813 807849257 908610557 434478945 29355656 300818989 997387 700259210 833202120 627894789 547693766 49478294 849699022 947036070 13322480 151451130 728571676

output:

1694736007
1787212838
1795497307
1801599852
1816568494
1830955508
1900043338
1992520169
1995554996
2000804638
2006907183
2021875825
2036262839
2066960640
2088031827
2096316296
2099859296
2102418841
2117387483
2129214952
2131774497
2189938806
2199864940
2200620596
2200862327
2204325820
2229976252
224...

result:

ok 250000 tokens

Test #13:

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

input:

19 250000
736936996 903529374 703948066 750875340 67863934 877593442 249721744 507574419 109644537 131038055 741277968 460051050 338044241 32254201 486093612 586125097 574357379 852627121 667485977

output:

2943808422
2964294905
2976062623
3028918081
3053452959
3061172282
3064908196
3073939442
3076675914
3085707160
3086301714
3098069432
3128949566
3129531372
3138562618
3149436049
3150924890
3161203767
3161785573
3170816819
3183179091
3195946251
3201661097
3207713969
3222147580
3233915298
3238594103
325...

result:

ok 250000 tokens

Test #14:

score: 0
Accepted
time: 37ms
memory: 7996kb

input:

20 250000
365480592 165524454 95482331 444160904 235297270 565222139 377486980 411935808 769154767 584136904 539638313 535927607 826168202 988561245 720021576 26470314 498335004 115652250 550516402 190990874

output:

2511677485
2521727248
2556176076
2607159816
2617209579
2651658407
2674070528
2730590882
2755550763
2765600526
2769552859
2800049354
2807115954
2817165717
2826073213
2851033094
2851614545
2861082857
2871203013
2877158077
2881252776
2887207840
2889164465
2894360239
2895531685
2904410002
2914988152
291...

result:

ok 250000 tokens

Test #15:

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

input:

100 100
149757254 852867076 248591228 463794835 572244029 358906112 268266905 73405431 556383144 78187515 140742343 522696411 855306735 896292421 264323102 606894557 315469714 209380389 718446401 516649987 497362371 769454915 717832506 66484638 447833042 667444094 538545228 848083522 395799090 78755...

output:

10540195851
10541292997
10578395346
10579492492
10591354820
10592451966
10602750679
10603847825
10604191658
10605288804
10610663289
10611760435
10614596775
10615693921
10623864644
10624628752
10624961790
10629554315
10630651461
10640950174
10642047320
10642391153
10643488299
10648862784
10649583759
...

result:

ok 100 tokens

Test #16:

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

input:

100 1000
495932529 199150317 561831430 287357773 221070233 990358114 673654534 289736438 695604558 263374416 62313814 176713171 319622283 193390208 904872998 122107648 154386836 754744977 639742769 211504753 22815204 127654792 693742047 392373017 444919438 244723763 961126767 33544411 146658716 8054...

output:

10875796157
10891207484
10898611361
10899797848
10914022688
10915209175
10922613052
10925327034
10929589500
10933938340
10934967762
10938024379
10940738361
10945000827
10948142238
10949328725
10949349667
10950379089
10953591191
10956753544
10957782966
10957940031
10958969453
10961569894
10963133911
...

result:

ok 1000 tokens

Test #17:

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

input:

1000 1000
656627728 814815335 316842250 421814798 211660491 622221407 333298828 257907754 993421897 204098399 233187465 25143330 497800702 128505978 990644362 947468103 318726662 75690996 570910263 891207264 427037357 684685973 452802193 620699315 224477880 984841116 819439929 27041053 964990228 777...

output:

125437823900
125438036871
125438890833
125439103804
125439163736
125439376707
125439783800
125439996771
125440230669
125440443640
125440850733
125441063704
125441123636
125441336607
125441576066
125441769636
125441789037
125441982607
125442190569
125442403540
125442642999
125442836569
125442855970
1...

result:

ok 1000 tokens

Test #18:

score: 0
Accepted
time: 134ms
memory: 87780kb

input:

249995 250000
242324517 58575166 669467030 690470232 973405769 555831604 306201651 176391686 92139483 30726428 848048257 87903995 737614543 35167703 846775343 6654707 229901293 719453403 636446282 174531627 964108703 661834987 400583204 43867950 551128601 776022005 931797041 721228268 667081635 5096...

output:

29154122521915
29154122529256
29154122529543
29154122536884
29154122537154
29154122541212
29154122543324
29154122544495
29154122544782
29154122548553
29154122548840
29154122550138
29154122550665
29154122550952
29154122552123
29154122552948
29154122556181
29154122556399
29154122556451
29154122557479
...

result:

ok 250000 tokens

Test #19:

score: 0
Accepted
time: 118ms
memory: 92088kb

input:

249996 250000
259841791 452514727 196969620 901331235 901758050 404069388 550071697 977936010 870121031 328562364 330027655 705293988 26180489 217722882 385832885 874424616 21403761 138476139 820983425 76498179 248919106 7959448 66795914 342176819 932912651 592202422 947975438 581104923 401017810 78...

output:

29010854332014
29010854335100
29010854336168
29010854339254
29010854343028
29010854346114
29010854346956
29010854347182
29010854348374
29010854350042
29010854350268
29010854351110
29010854351460
29010854352528
29010854354196
29010854355614
29010854356666
29010854357970
29010854359388
29010854359752
...

result:

ok 250000 tokens

Test #20:

score: 0
Accepted
time: 125ms
memory: 88872kb

input:

249997 250000
277359064 846454289 93068430 743596018 535143039 957339882 793941743 484513042 574473649 626398301 443410835 954087761 683342656 473906990 588453940 742194524 149342718 926095097 374116787 273432024 197293021 59116618 733008625 640485688 241067772 334753910 595557615 72385358 766357767...

output:

29050956115671
29050956118730
29050956131715
29050956134774
29050956141777
29050956144104
29050956144836
29050956145673
29050956147163
29050956148732
29050956148960
29050956152019
29050956157821
29050956160148
29050956160880
29050956161717
29050956163207
29050956164776
29050956165004
29050956166874
...

result:

ok 250000 tokens

Test #21:

score: 0
Accepted
time: 146ms
memory: 86780kb

input:

249998 250000
663472558 871797630 915538312 585860802 758462612 805577666 37811789 917461147 352455196 924234237 220357525 571477753 676941311 656462169 127511482 683593360 940845186 345117833 927250149 175398576 482103425 405241080 30625116 233761848 212786405 740868910 906703304 563665794 50029394...

output:

28992301328927
28992301330535
28992301335477
28992301337085
28992301338497
28992301340105
28992301340175
28992301341783
28992301345047
28992301346655
28992301346725
28992301348333
28992301348723
28992301349745
28992301350143
28992301350331
28992301351353
28992301351751
28992301355265
28992301355273
...

result:

ok 250000 tokens

Test #22:

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

input:

249999 250000
680989832 265737191 443040902 796721805 391847601 653815451 281681835 424038178 130436743 853473953 333740704 820271526 965507258 207613568 330132536 256395976 68784142 469173279 816820000 708768909 61881120 751365542 401870535 532070717 225974235 483420399 922881702 423542449 16060119...

output:

29013779199263
29013779209258
29013779212316
29013779217081
29013779219146
29013779220241
29013779222236
29013779222311
29013779225964
29013779227076
29013779229141
29013779229695
29013779230134
29013779230236
29013779232199
29013779232231
29013779233294
29013779235289
29013779235959
29013779236964
...

result:

ok 250000 tokens

Test #23:

score: 0
Accepted
time: 138ms
memory: 87896kb

input:

250000 250000
158354229 244254472 945687432 656981529 910967723 750660448 992641720 49901053 883123077 305097885 185445851 480382266 937740522 380605743 874726173 616163448 62037729 927915312 559206505 291543349 442683310 175488107 108158332 884091741 614383800 237112624 134653303 407028950 89220783...

output:

28997765454926
28997765463718
28997765475819
28997765479914
28997765482243
28997765483702
28997765484611
28997765486576
28997765488706
28997765491035
28997765492494
28997765495368
28997765495564
28997765496099
28997765500807
28997765503136
28997765504356
28997765504595
28997765504891
28997765507166
...

result:

ok 250000 tokens

Test #24:

score: 0
Accepted
time: 142ms
memory: 89924kb

input:

250000 249999
540522487 238626465 814435742 884649839 858821514 911577430 500978215 825748224 786278080 594138001 223146488 727695933 486116588 528900597 919648141 938897477 594078263 383321675 830842814 593257053 983941278 433101601 230416600 913354968 558857455 899421047 151228499 723652094 212144...

output:

28941585233366
28941585234337
28941585241642
28941585242613
28941585245786
28941585246757
28941585254062
28941585255033
28941585256629
28941585257600
28941585264905
28941585265876
28941585269049
28941585270020
28941585277325
28941585278296
28941585278666
28941585279637
28941585286942
28941585287913
...

result:

ok 249999 tokens

Test #25:

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

input:

250000 1
270013359 32164081 667857110 547793192 71154006 457331441 937648056 377327067 930238750 903623304 461946134 789441206 964555936 246145769 43615341 223931625 437477999 396339078 859841605 138539702 833787 672567460 129882977 952614643 246363407 134833279 623430195 433591907 167237757 2880343...

output:

28965504397791

result:

ok "28965504397791"

Test #26:

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

input:

1 1
0

output:

0

result:

ok "0"

Test #27:

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

input:

1 1
1000000000

output:

1000000000

result:

ok "1000000000"

Test #28:

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

input:

1 250000
0

output:

0
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 250000 tokens

Test #29:

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

input:

1 250000
1000000000

output:

1000000000
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 250000 tokens

Test #30:

score: 0
Accepted
time: 24ms
memory: 33288kb

input:

250000 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

0

result:

ok "0"

Test #31:

score: 0
Accepted
time: 31ms
memory: 33520kb

input:

250000 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

83334

result:

ok "83334"

Test #32:

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

input:

250000 1
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000...

output:

83334000000000

result:

ok "83334000000000"

Test #33:

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

input:

250000 250000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 250000 tokens

Test #34:

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

input:

250000 250000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
83334
...

result:

ok 250000 tokens

Test #35:

score: 0
Accepted
time: 104ms
memory: 40228kb

input:

250000 250000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 ...

output:

83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
83334000000000
...

result:

ok 250000 tokens

Test #36:

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

input:

250000 250000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
8350380459
835...

result:

ok 250000 tokens

Test #37:

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

input:

249999 250000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
5504979674
550...

result:

ok 250000 tokens

Test #38:

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

input:

249998 250000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
6859697814
685...

result:

ok 250000 tokens

Test #39:

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

input:

249997 250000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
9678320662
967...

result:

ok 250000 tokens

Test #40:

score: 0
Accepted
time: 152ms
memory: 93392kb

input:

250000 250000
217571575 471875037 548320924 593804290 521513418 177168634 182090692 657703455 744610674 507449961 382426721 584727314 248341856 633650343 407603926 901660488 859682221 136279919 861785034 449790353 802572714 462293711 701183770 908251138 836218714 812375108 164322209 368961658 792614...

output:

35525129550534
35525129550607
35525129550971
35525129551044
35525129552789
35525129552862
35525129553226
35525129553299
35525129554444
35525129554517
35525129554881
35525129554954
35525129555095
35525129555168
35525129555532
35525129555605
35525129556699
35525129556772
35525129556817
35525129556890
...

result:

ok 250000 tokens

Test #41:

score: 0
Accepted
time: 163ms
memory: 91552kb

input:

250000 250000
578859742 733033823 417965179 925189762 539343953 916739937 741737520 850775570 725698523 254639640 782619709 535640479 798207062 606411453 739334394 170360662 131783837 742190316 612774172 264583231 561940442 672720804 726118505 706153124 373695200 820554732 468319431 175414377 580164...

output:

35428275148325
35428275148380
35428275148568
35428275148623
35428275148779
35428275148834
35428275148892
35428275148947
35428275149022
35428275149077
35428275149135
35428275149142
35428275149190
35428275149197
35428275149339
35428275149346
35428275149385
35428275149394
35428275149401
35428275149440
...

result:

ok 250000 tokens

Test #42:

score: 0
Accepted
time: 131ms
memory: 106300kb

input:

250000 250000
449489495 161976586 859115356 146338817 922644947 348663240 452562976 461208930 856560466 286045812 405769480 850135246 853970870 237802757 938308149 740811348 556256748 361480761 923082000 760869953 556535582 285449946 267960299 523562566 577028380 869065941 909660370 735009378 237306...

output:

34192176309930
34192176309931
34192176309946
34192176309947
34192176309974
34192176309975
34192176309990
34192176309991
34192176309997
34192176309998
34192176310013
34192176310014
34192176310014
34192176310015
34192176310022
34192176310023
34192176310030
34192176310031
34192176310032
34192176310033
...

result:

ok 250000 tokens

Test #43:

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

input:

250000 250000
999998535 999997985 999990234 999999768 999992021 999997760 999997400 999996745 999992626 999992335 999990006 999990190 999993462 999998973 999998933 999991038 999993564 999990246 999998915 999998536 999991671 999994770 999991404 999994317 999999171 999994898 999994701 999992715 999992...

output:

83333582363788
83333582364708
83333582365729
83333582365796
83333582365815
83333582365909
83333582366584
83333582367380
83333582367504
83333582367519
83333582367653
83333582368019
83333582368125
83333582368525
83333582368573
83333582368577
83333582368592
83333582368611
83333582368705
83333582368780
...

result:

ok 250000 tokens

Test #44:

score: 0
Accepted
time: 157ms
memory: 100012kb

input:

250000 250000
999999847 999999406 999999672 999999307 999999059 999999696 999999775 999999767 999999727 999999199 999999440 999999476 999999639 999999690 999999187 999999541 999999399 999999434 999999163 999999867 999999951 999999043 999999037 999999338 999999026 999999745 999999927 999999578 999999...

output:

83333958005577
83333958005597
83333958005650
83333958005659
83333958005719
83333958005757
83333958005763
83333958005765
83333958005770
83333958005785
83333958005838
83333958005847
83333958005862
83333958005882
83333958005907
83333958005929
83333958005935
83333958005943
83333958005944
83333958005945
...

result:

ok 250000 tokens

Test #45:

score: 0
Accepted
time: 168ms
memory: 110736kb

input:

250000 250000
999999932 999999996 999999912 999999960 999999960 999999924 999999940 999999910 999999943 999999981 999999982 999999909 999999986 999999971 999999928 999999911 999999977 999999993 999999963 999999983 999999989 999999955 999999963 999999975 999999911 999999921 999999971 999999947 999999...

output:

83333995825969
83333995825985
83333995825990
83333995825994
83333995826000
83333995826000
83333995826015
83333995826016
83333995826021
83333995826025
83333995826031
83333995826031
83333995826036
83333995826040
83333995826042
83333995826044
83333995826046
83333995826047
83333995826052
83333995826054
...

result:

ok 250000 tokens

Test #46:

score: 0
Accepted
time: 159ms
memory: 106608kb

input:

250000 250000
1000000000 999999999 999999994 999999999 999999991 999999992 999999994 999999993 999999999 999999995 999999997 999999994 999999990 1000000000 999999990 999999995 1000000000 999999995 999999999 999999994 999999994 999999993 999999993 999999998 999999993 999999991 999999999 999999992 999...

output:

83333999582522
83333999582523
83333999582525
83333999582525
83333999582527
83333999582527
83333999582528
83333999582528
83333999582529
83333999582530
83333999582530
83333999582530
83333999582530
83333999582530
83333999582530
83333999582531
83333999582531
83333999582531
83333999582531
83333999582532
...

result:

ok 250000 tokens

Test #47:

score: 0
Accepted
time: 147ms
memory: 110140kb

input:

250000 250000
999999999 999999999 999999999 999999999 999999999 1000000000 999999999 999999999 1000000000 1000000000 1000000000 999999999 1000000000 999999999 1000000000 1000000000 1000000000 999999999 999999999 1000000000 1000000000 1000000000 1000000000 1000000000 999999999 999999999 999999999 100...

output:

83333999958211
83333999958211
83333999958211
83333999958211
83333999958211
83333999958211
83333999958211
83333999958211
83333999958211
83333999958212
83333999958212
83333999958212
83333999958212
83333999958212
83333999958212
83333999958212
83333999958212
83333999958212
83333999958212
83333999958212
...

result:

ok 250000 tokens

Test #48:

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

input:

250000 250000
2 2 2 1 2 1 1 1 1 2 2 1 1 1 2 1 1 1 2 2 1 1 1 2 2 2 1 2 2 1 2 1 1 2 1 1 1 1 2 1 1 1 2 2 1 2 2 2 2 2 1 1 1 1 2 1 1 2 1 1 1 2 2 1 2 2 2 1 2 2 1 2 2 1 2 2 2 2 2 1 1 1 2 1 2 1 1 2 1 1 1 2 2 2 2 1 2 1 1 2 1 1 1 2 2 2 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 2 1 1 1 1 2 2 2 1 1 1 2 1 2 1 2 1 1 1 1 1 1 ...

output:

110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292
110292...

result:

ok 250000 tokens

Test #49:

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

input:

250000 250000
14 19 19 13 17 15 20 15 12 18 12 19 18 13 18 16 13 19 11 17 10 18 18 13 17 11 16 17 19 19 14 15 10 14 16 17 16 14 15 19 12 16 14 17 10 18 12 16 18 13 16 15 18 10 13 12 13 11 14 15 14 20 13 14 11 19 19 11 20 14 18 19 16 10 18 13 18 12 20 14 15 15 13 11 20 19 11 16 20 18 10 10 17 17 20 1...

output:

1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173880
1173...

result:

ok 250000 tokens

Test #50:

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

input:

250000 250000
146 114 192 104 103 112 166 168 130 187 197 121 128 124 117 162 162 144 133 117 163 143 176 116 127 193 106 165 127 142 163 138 195 138 125 115 152 109 196 191 146 161 166 189 165 126 169 130 138 168 191 194 140 192 139 179 135 160 112 179 183 197 194 190 113 166 163 184 153 154 105 18...

output:

11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
11835803
118...

result:

ok 250000 tokens

Test #51:

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

input:

250000 250000
5 5 6 5 6 5 6 5 5 6 5 6 6 6 5 6 5 6 5 5 5 5 6 6 6 6 6 5 5 6 6 5 6 5 5 6 5 6 6 5 5 5 5 6 5 6 5 5 6 5 5 6 6 6 5 5 6 6 6 6 6 5 6 5 6 5 5 6 6 6 5 5 6 5 6 5 6 5 6 5 5 5 5 5 5 5 6 6 5 6 5 6 5 5 6 6 5 5 5 6 5 6 6 5 5 6 5 5 5 6 5 5 6 6 5 6 5 6 5 6 6 6 6 5 5 5 6 5 6 6 5 5 5 5 5 6 6 6 5 5 5 5 5 ...

output:

452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252
452252...

result:

ok 250000 tokens

Test #52:

score: 0
Accepted
time: 83ms
memory: 58648kb

input:

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

output:

820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184
820184...

result:

ok 250000 tokens

Test #53:

score: 0
Accepted
time: 2ms
memory: 7992kb

input:

18 250000
999999542 0 999999646 999999481 0 999999005 999999996 0 999999224 999999685 0 999999494 999999980 0 999999882 999999558 0 999999492

output:

0
999999005
999999224
999999481
999999492
999999494
999999542
999999558
999999646
999999685
999999882
999999980
999999996
1999998229
1999998229
1999998486
1999998486
1999998497
1999998499
1999998547
1999998563
1999998651
1999998651
1999998690
1999998705
1999998716
1999998718
1999998718
1999998766
19...

result:

ok 250000 tokens

Test #54:

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

input:

18 250000
1000000000 0 999999952 999999989 0 999999966 999999914 0 999999904 999999910 0 999999912 999999902 0 999999931 999999900 0 999999954

output:

0
999999900
999999902
999999904
999999910
999999912
999999914
999999931
999999952
999999954
999999966
999999989
1000000000
1999999802
1999999802
1999999804
1999999806
1999999810
1999999812
1999999812
1999999812
1999999814
1999999814
1999999814
1999999816
1999999816
1999999816
1999999818
1999999818
1...

result:

ok 250000 tokens

Test #55:

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

input:

18 250000
999999996 0 999999994 1000000000 0 999999994 1000000000 0 999999990 999999992 0 999999999 999999995 0 1000000000 999999997 0 999999998

output:

0
999999990
999999992
999999994
999999994
999999995
999999996
999999997
999999998
999999999
1000000000
1000000000
1000000000
1999999982
1999999984
1999999984
1999999984
1999999985
1999999986
1999999986
1999999986
1999999987
1999999987
1999999987
1999999988
1999999988
1999999988
1999999988
1999999989...

result:

ok 250000 tokens

Test #56:

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

input:

18 250000
999999999 0 999999999 999999999 0 1000000000 1000000000 0 1000000000 999999999 0 999999999 1000000000 0 999999999 1000000000 0 999999999

output:

0
999999999
999999999
999999999
999999999
999999999
999999999
999999999
1000000000
1000000000
1000000000
1000000000
1000000000
1999999998
1999999998
1999999998
1999999998
1999999998
1999999998
1999999998
1999999998
1999999998
1999999998
1999999998
1999999998
1999999998
1999999998
1999999998
19999999...

result:

ok 250000 tokens

Test #57:

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

input:

18 250000
1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000

output:

0
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2000000000
2...

result:

ok 250000 tokens

Test #58:

score: 0
Accepted
time: 2ms
memory: 10060kb

input:

99 25000
999999251 0 999999332 999999326 0 999999302 999999123 0 999999604 999999820 0 999999664 999999193 0 999999901 999999175 0 999999635 999999640 0 999999069 999999608 0 999999356 999999031 0 999999527 999999174 0 999999119 999999097 0 999999190 999999675 0 999999882 999999893 0 999999299 99999...

output:

0
999999008
999999031
999999044
999999044
999999069
999999075
999999097
999999100
999999119
999999123
999999168
999999174
999999175
999999190
999999193
999999201
999999250
999999251
999999253
999999253
999999283
999999299
999999302
999999309
999999326
999999332
999999333
999999335
999999344
99999935...

result:

ok 25000 tokens

Test #59:

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

input:

99 25000
999999940 0 999999980 999999992 0 999999937 999999957 0 999999909 999999948 0 999999959 999999984 0 999999996 999999973 0 999999903 999999912 0 999999963 999999925 0 999999969 999999934 0 999999928 999999987 0 999999932 999999966 0 999999935 999999931 0 999999974 999999927 0 999999965 99999...

output:

0
999999901
999999903
999999906
999999909
999999912
999999912
999999913
999999915
999999918
999999920
999999922
999999925
999999926
999999927
999999928
999999929
999999929
999999930
999999931
999999932
999999934
999999935
999999935
999999937
999999937
999999937
999999940
999999940
999999940
99999994...

result:

ok 25000 tokens

Test #60:

score: 0
Accepted
time: 2ms
memory: 8188kb

input:

99 25000
999999997 0 999999996 999999995 0 1000000000 999999993 0 999999992 1000000000 0 999999992 999999993 0 999999992 999999998 0 999999995 999999999 0 999999991 1000000000 0 999999996 999999999 0 1000000000 999999995 0 999999990 999999993 0 999999997 1000000000 0 999999999 999999995 0 999999997 ...

output:

0
999999990
999999990
999999990
999999990
999999991
999999991
999999991
999999991
999999991
999999991
999999991
999999992
999999992
999999992
999999992
999999992
999999992
999999993
999999993
999999993
999999993
999999994
999999994
999999994
999999994
999999994
999999995
999999995
999999995
99999999...

result:

ok 25000 tokens

Test #61:

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

input:

99 25000
1000000000 0 999999999 1000000000 0 999999999 999999999 0 1000000000 1000000000 0 999999999 999999999 0 999999999 999999999 0 999999999 1000000000 0 999999999 1000000000 0 999999999 999999999 0 999999999 1000000000 0 999999999 999999999 0 999999999 1000000000 0 1000000000 999999999 0 999999...

output:

0
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
99999999...

result:

ok 25000 tokens

Test #62:

score: 0
Accepted
time: 2ms
memory: 10100kb

input:

99 25000
1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 100...

output:

0
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1...

result:

ok 25000 tokens

Test #63:

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

input:

249999 250000
166635 0 183389 124823 0 191296 107403 0 115526 107275 0 179969 114715 0 101642 128194 0 162291 130853 0 195887 114814 0 167530 155366 0 153521 158431 0 139934 199746 0 197913 114162 0 126756 175460 0 180963 151472 0 128397 166976 0 102609 175490 0 141893 147814 0 138794 180181 0 11379...

output:

0
100001
100001
100001
100001
100002
100002
100003
100003
100003
100003
100005
100005
100006
100006
100006
100006
100007
100007
100008
100008
100009
100010
100010
100011
100011
100011
100011
100011
100012
100012
100012
100013
100013
100014
100015
100015
100015
100016
100017
100017
100017
100017
1000...

result:

ok 250000 tokens

Test #64:

score: 0
Accepted
time: 169ms
memory: 90908kb

input:

249999 250000
718156973 0 766003157 496024779 0 984033247 235439383 0 281221663 948643758 0 317823945 530154614 0 228778831 977219806 0 556685550 834486753 0 975624883 721449967 0 681783215 792703400 0 242024516 468377110 0 247668918 285353870 0 230751008 841680631 0 981958200 498782295 0 487701966 ...

output:

0
200002346
200002953
200004946
200014472
200015216
200016052
200025725
200027894
200035342
200040135
200044170
200051062
200051734
200057780
200068286
200069889
200077427
200077630
200078413
200084564
200085753
200088447
200088501
200091066
200099658
200102079
200102701
200103731
200105081
20011156...

result:

ok 250000 tokens

Test #65:

score: 0
Accepted
time: 201ms
memory: 91904kb

input:

249999 250000
996604089 0 983502337 995549150 0 955444371 922713978 0 942734582 993367550 0 962183658 986467398 0 953967241 916534740 0 957424903 927592673 0 990642561 917740059 0 989093574 999660749 0 913697108 984160092 0 930140316 904517218 0 949762464 959024668 0 988491172 960560919 0 944608415 ...

output:

0
900000248
900000914
900001435
900002174
900002177
900003074
900004396
900004992
900005215
900006035
900006251
900006499
900007799
900008169
900008698
900009046
900009092
900009251
900009411
900009429
900010395
900010776
900011387
900012692
900013202
900013720
900013935
900014058
900014271
90001434...

result:

ok 250000 tokens

Test #66:

score: 0
Accepted
time: 173ms
memory: 87812kb

input:

249999 250000
992283963 0 996300886 991301364 0 996166226 991306689 0 992339023 995884218 0 995488968 991062989 0 999575740 997939750 0 994770505 990513076 0 990280039 996860704 0 999068239 996828190 0 999267836 996717893 0 991173550 990094324 0 992439692 992411608 0 994934284 992380371 0 994340286 ...

output:

0
990000028
990000079
990000130
990000179
990000180
990000230
990000277
990000294
990000345
990000358
990000361
990000389
990000393
990000551
990000558
990000637
990000821
990000858
990000876
990000888
990000913
990000999
990001052
990001094
990001138
990001145
990001213
990001248
990001248
99000129...

result:

ok 250000 tokens

Test #67:

score: 0
Accepted
time: 162ms
memory: 90588kb

input:

249999 250000
999229316 0 999101272 999774698 0 999343990 999841605 0 999394036 999188649 0 999759221 999710241 0 999131171 999239345 0 999154364 999800566 0 999167962 999672642 0 999929536 999928640 0 999912711 999671649 0 999517643 999419161 0 999063781 999188837 0 999895175 999301990 0 999229381 ...

output:

0
999000013
999000021
999000030
999000038
999000057
999000070
999000079
999000084
999000092
999000098
999000115
999000122
999000123
999000132
999000133
999000139
999000152
999000159
999000159
999000163
999000163
999000165
999000166
999000179
999000181
999000183
999000188
999000192
999000206
99900021...

result:

ok 250000 tokens

Test #68:

score: 0
Accepted
time: 161ms
memory: 91608kb

input:

249999 250000
999970517 0 999911096 999904127 0 999944688 999980027 0 999912118 999933714 0 999900372 999969941 0 999956890 999945218 0 999993597 999962917 0 999978246 999906185 0 999929088 999967443 0 999901175 999932285 0 999966323 999923904 0 999988450 999945504 0 999916255 999983469 0 999987661 ...

output:

0
999900000
999900000
999900002
999900002
999900002
999900003
999900003
999900003
999900003
999900003
999900004
999900004
999900005
999900006
999900007
999900008
999900010
999900010
999900010
999900010
999900010
999900010
999900011
999900013
999900013
999900013
999900013
999900014
999900014
99990001...

result:

ok 250000 tokens

Test #69:

score: 0
Accepted
time: 152ms
memory: 83536kb

input:

249999 250000
999991655 0 999995899 999996748 0 999998532 999993103 0 999997519 999990530 0 999998053 999995326 0 999993038 999993614 0 999995308 999992439 0 999997247 999998614 0 999999462 999999812 0 999995105 999992181 0 999992296 999997684 0 999998094 999999231 0 999992192 999997971 0 999999847 ...

output:

0
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990000
999990001
999990001
999990001
999990001
999990001
999990001
999990001
99999000...

result:

ok 250000 tokens

Test #70:

score: 0
Accepted
time: 172ms
memory: 73308kb

input:

249999 250000
999999208 0 999999208 999999224 0 999999894 999999034 0 999999392 999999526 0 999999823 999999154 0 999999316 999999327 0 999999935 999999200 0 999999491 999999864 0 999999535 999999045 0 999999232 999999197 0 999999157 999999005 0 999999793 999999364 0 999999227 999999098 0 999999318 ...

output:

0
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
999999000
99999900...

result:

ok 250000 tokens

Test #71:

score: 0
Accepted
time: 149ms
memory: 62804kb

input:

249999 250000
999999929 0 999999911 999999945 0 999999970 999999999 0 999999916 999999907 0 999999992 999999966 0 999999918 999999939 0 999999914 999999929 0 999999960 999999910 0 999999985 999999977 0 999999927 999999952 0 999999990 999999986 0 999999934 999999912 0 999999969 999999917 0 999999944 ...

output:

0
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
999999900
99999990...

result:

ok 250000 tokens

Test #72:

score: 0
Accepted
time: 135ms
memory: 51712kb

input:

249999 250000
999999995 0 999999993 999999996 0 999999999 999999991 0 999999999 999999998 0 999999995 999999998 0 999999991 999999990 0 999999991 999999994 0 999999999 999999996 0 1000000000 999999991 0 999999994 999999999 0 999999999 999999998 0 999999995 999999993 0 999999990 999999992 0 999999997...

output:

0
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
999999990
99999999...

result:

ok 250000 tokens

Test #73:

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

input:

249999 250000
999999999 0 999999999 1000000000 0 999999999 999999999 0 1000000000 999999999 0 999999999 999999999 0 1000000000 999999999 0 999999999 999999999 0 999999999 999999999 0 999999999 1000000000 0 1000000000 999999999 0 1000000000 999999999 0 1000000000 1000000000 0 1000000000 1000000000 0 ...

output:

0
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
999999999
99999999...

result:

ok 250000 tokens

Test #74:

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

input:

249999 250000
1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 1000000000 0 100000000...

output:

0
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1...

result:

ok 250000 tokens

Test #75:

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

input:

250000 250000
24772 3556 6761 6496 6009 28423 27149 34652 11094 33242 26253 29133 30840 13518 11709 28877 16692 27806 26 8872 6205 23831 26178 38428 12809 31676 21208 39328 7093 31451 24381 21781 5400 35643 29468 33612 1151 29339 31866 37175 29625 28102 36182 21814 8450 5555 5742 27098 22268 16745 2...

output:

1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298106
1162298107
1162298107
1162298107
1162298107
1162298107
1162298107
1162298107
1162298107
1162298107
1162298107
1162298107
116...

result:

ok 250000 tokens