QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#461910#1125. Triple JumpTaoRan100 ✓538ms76948kbC++142.4kb2024-07-03 10:11:382024-07-03 10:11:39

Judging History

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

  • [2024-07-03 10:11:39]
  • 评测
  • 测评结果:100
  • 用时:538ms
  • 内存:76948kb
  • [2024-07-03 10:11:38]
  • 提交

answer

#include<bits/stdc++.h>
#define pt putchar
using namespace std;
typedef long long ll;
int read();void write(int);
const int N=5e5+5;
int n,a[N],q;
int ld[N];
int st[N],top;
vector<int>J[N],Q[N];
int r[N];//query,also ans

namespace SGT{
	int mxa[N*4],mxb[N*4],ans[N*4];
	#define se int k,int l,int r
	#define lc k<<1,l,(l+r)>>1
	#define rc k<<1|1,((l+r)>>1)+1,r
	void build(se){
		if(l==r){
			ans[k]=mxa[k]=a[l];
			return;
		}
		build(lc);build(rc);
		mxa[k]=max(mxa[k<<1],mxa[k<<1|1]);
		ans[k]=max(ans[k<<1],ans[k<<1|1]);
	}
	void md(se,int x,int y,int v){
		if(y<l||r<x)return;
		if(x<=l&&r<=y){
			mxb[k]=max(mxb[k],v);
			ans[k]=max(ans[k],mxb[k]+mxa[k]);
			return;
		}
		md(lc,x,y,v);md(rc,x,y,v);
		ans[k]=max(mxb[k]+mxa[k],max(ans[k<<1],ans[k<<1|1]));
	}
	int qu(se,int x,int y,int&ma){
		if(y<l||r<x)return 0;
		if(x<=l&&r<=y){
			ma=max(ma,mxa[k]);
			return ans[k];
		}
		int d=0,pre=max(qu(lc,x,y,d),qu(rc,x,y,d));
		ma=max(ma,d);
		return max(d+mxb[k],pre);
	} 
}

void add(int i,int j){
	if(1<=i&&j<=n&&j*2-i<=n){
		J[i].push_back(j);
		//printf("%d %d added\n",i,j);
	}
}
int main(){
	n=read();
	a[0]=a[n+1]=2e8;
	for(int i=1;i<=n;i++){
		a[i]=read();
		while(top&&a[st[top]]<=a[i])top--;
		ld[i]=st[top];
		st[++top]=i;
	}
	st[top=0]=n+1;
	for(int i=n;i>=1;i--){
		while(top&&a[st[top]]<=a[i])top--;
		add(ld[i],st[top]);
		add(i-1,i);
		st[++top]=i;
	}
	q=read();
	for(int i=1;i<=q;i++){
		int l=read();r[i]=read();
		Q[l].push_back(i);
	}
	SGT::build(1,1,n);
	for(int l=n-2;l>=1;l--){
		//printf("now:%d\n",l);
		for(int j:J[l]){
			//if(l==3)printf("l:%d %d\n",SGT::ans[3],SGT::ans[7]);
			SGT::md(1,1,n,j*2-l,n,a[l]+a[j]);
			//printf("mx %d %d %d\n",j*2-l,n,a[l]+a[j]);
			//if(l==3)printf("l:%d %d\n",SGT::ans[3],SGT::ans[7]);
		}
		//if(l==2)printf("ans:%d\n",SGT::ans[7]);
		for(int j:Q[l]){
			int o=0;
			//printf("qu %d:%d %d\n",j,1,r[j]);
			r[j]=SGT::qu(1,1,n,l,r[j],o);
		}
	}
	for(int i=1;i<=q;i++){
		write(r[i]),pt('\n');
	}
	return 0;
}
/*
15
12 96 100 61 54 66 37 34 58 21 21 1 13 50 81
1
11 14
*/
int read(){
	int x=0,f=1;
	char c='A';
	while(c<'0'||c>'9'){
		c=getchar();
		if(c=='-')f=-f;
	}
	while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
	return x*f;
}
void write(int x){
	if(x<0){
		pt('-');
		x=-x;
	}
	if(x>9){
		write(x/10);
	}
	pt(x%10+'0');
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 3ms
memory: 27068kb

input:

3
35041638 72086941 5735545
1
1 3

output:

112864124

result:

ok single line: '112864124'

Test #2:

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

input:

100
48258558 37853765 98979078 92184541 88760197 59062757 26613354 91913583 79783323 66166803 40742419 10810785 60237885 56741278 3713065 2777421 58054601 74111264 47210626 6355466 732504 42443373 46601769 70103196 91093141 98614969 26595280 21035750 57646940 5265869 33227494 49003491 32066630 33747...

output:

297258753
292314534
289679076
292314534
290193258
64545087
287236529
280611174
292314534
289778588
235934697
287236529
292314534
289679076
281107511
292314534
282713093
281107511
292314534
284705839
292314534
179376491
287037037
292314534
259811306
255613212
280611174
287236529
280643746
292314534
2...

result:

ok 100 lines

Test #3:

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

input:

100
1935311 2193438 2566095 4407172 5604285 5918981 6949716 8250740 9457277 9850823 9985282 10954975 11264769 12638711 12833203 13918528 14802738 15917882 15956168 16741284 16785387 17060761 17623099 17652864 19001277 19168284 19443443 19489730 19721151 22145450 22436629 23837222 24029026 24273517 2...

output:

294357964
294357964
154685230
249621121
89844057
121456053
209201172
142125051
82262818
115919033
113837099
102449866
152151933
180131774
233334082
135680523
294357964
251257908
152151933
164313917
135680523
51469247
233334082
276300276
72139765
164313917
294357964
136888109
269760370
102449866
1530...

result:

ok 100 lines

Test #4:

score: 0
Accepted
time: 5ms
memory: 27156kb

input:

100
99341983 99281616 97843536 97829647 96130364 96126614 93922553 93553752 93077870 91619385 90557288 90357942 89300775 88931919 88436745 88304946 87676106 87614357 87004388 86391591 86368206 85691492 84378299 83466621 82898425 82713029 82267638 78754711 78601471 77058451 75834396 75790190 75639542...

output:

296467135
106509714
261010336
250743345
137434117
258451289
296467135
175851065
109773177
280554175
291803547
249078075
128376084
170468653
247879092
50306055
194220348
278251007
259764185
18966553
185500163
265673610
166510969
243735378
134837618
247879092
203475927
294954799
278251007
180504053
60...

result:

ok 100 lines

Test #5:

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

input:

100
100000000 4825647 33847170 35370359 49931028 6056202 64378194 33392860 82380318 79526073 76438619 29819896 30483689 39898228 74354021 27944495 44998767 85672876 48847433 9882864 50369226 93321876 22660534 3287894 83447728 50915393 54947746 18729197 73303735 60649113 374215 12260558 11112474 8442...

output:

299894487
293975643
299894487
267766305
261193694
299894487
267621480
263418842
244262367
252299693
73283886
267766305
196689540
297663372
263418842
299894487
289150449
251585304
236772269
293975643
299894487
293975643
253348773
289150449
297663372
299002321
293975643
289150449
253348773
299894487
2...

result:

ok 100 lines

Test #6:

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

input:

100
6372403 10482009 17427464 29045037 100000000 2214306 28744838 84728320 98772402 28597459 17246867 89066394 13201029 95008685 79052649 41590532 33952321 40545511 32879679 27474352 80236028 17053084 49365207 35242834 9396193 30891299 64511625 49704228 349026 58757024 40908937 13368919 94435019 407...

output:

299999997
293514560
194112860
274017115
288216106
297053902
291845292
278509407
194100980
251560827
293781087
186942626
297053902
291845292
220225008
291845292
294087486
105511814
297053902
288878876
267421552
293781087
217703668
227489969
298772402
239182672
297053902
251560827
297053902
293781087
...

result:

ok 100 lines

Test #7:

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

input:

100
6749418 6661547 6802769 6527560 6198977 6419054 6949411 6461370 6282469 6459574 6733887 6082049 6653845 6335052 6656731 6245767 6304435 6415683 6035793 6988812 6473554 6331777 6928739 629 999 617 230 414 997 146 758 514 885 816 625 107 533 675 656 745 829 901 488 879 370 317 26 399 394 223 772 7...

output:

113938223
1208
1759
100001898
2609
26554347
20391105
20391105
26554347
2368
108436263
100001944
20391105
2609
2609
113938223
20391105
108928604
20413727
20391105
108928604
26536675
113938223
6930735
113938223
20391105
113260516
19794143
100001898
113917551
1864
20391105
108436263
20672110
113402293
...

result:

ok 100 lines

Test #8:

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

input:

100
6340574 6001526 6392645 6180947 6347458 6433053 6488849 6375443 6440414 831 168 230 475 513 505 975 143 66 596 454 20 599 255 16 909 303 357 795 34 791 466 917 324 978 329 588 103 994 507 212 169 597 701 972 73 100000000 767 825 735 635 681 906 668 951 944 977 374 473 672 247 41 101 851 830 843 ...

output:

113326401
100001972
12816832
26485276
108873565
26485276
19362316
100001673
108873565
26485276
2889
100001673
108873565
112929263
100001972
1467
1649
19362316
100001972
25120729
100001972
112929263
112929263
108873565
112929263
2303
26485276
100001972
2007
108873565
26485276
100001972
108873565
2631...

result:

ok 100 lines

Test #9:

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

input:

100
6119144 6153815 6379517 6343659 6305330 6177008 6346761 6197501 6218191 231 453 762 20 956 560 485 878 671 958 923 152 173 965 385 726 848 718 835 857 114 693 513 766 337 162 965 876 171 110 82 91 146 955 758 571 100000000 29 635 124 329 117 575 62 900 614 997 566 905 195 974 147 117 553 827 296...

output:

113372452
26864697
100001962
112690420
26864697
100001855
19069937
108981511
100001888
108981511
113339696
108981511
2796
108322345
26864697
1726
112690420
100001952
100001962
108981511
26864697
100001962
2471
100001962
108981511
2888
100001952
108981511
100001962
2888
25427990
2515
108981511
207122...

result:

ok 100 lines

Test #10:

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

input:

100
100000000 46655511 24367489 66906791 31639775 54762745 11555768 1831624 50590105 48189276 100000000 39722957 95572856 72487557 83225254 100000000 47694821 96514857 100000000 100000000 34054710 69896972 18332183 97923215 85436530 72566604 97434197 34362117 100000000 35423392 47932773 93405675 660...

output:

300000000
299999999
117031383
297923215
299999998
208838083
117207438
300000000
300000000
300000000
206630893
208838083
300000000
300000000
300000000
113391663
300000000
296514857
113391663
24337703
208838083
208838083
300000000
299999999
300000000
206630893
299999997
299999997
206542031
300000000
2...

result:

ok 100 lines

Subtask #2:

score: 14
Accepted

Dependency #1:

100%
Accepted

Test #11:

score: 14
Accepted
time: 138ms
memory: 32904kb

input:

5000
83589685 47668026 4767612 66323324 41271176 63518884 41214547 71570825 63408324 68057725 80116720 24395895 16830206 8728376 37200038 68406191 29774958 24565569 31365326 82499255 8137649 33277013 57196109 47513658 69067203 26884741 64609078 90289452 11682474 99553358 79405795 21589615 51244298 7...

output:

299844092
299570906
289915799
299641794
299147975
298228585
298679957
299577971
299562221
299745225
294941613
287092781
299745225
299570906
299513020
299510134
299779605
299513020
298750731
299745225
299745225
299779605
299745225
299745225
299728925
299745225
299745225
292489790
299510134
299513020
...

result:

ok 500000 lines

Test #12:

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

input:

5000
352 15748 19695 24266 25922 37068 97876 111993 134944 146419 153193 188018 190943 191142 200628 259607 271996 296410 312024 328706 333050 344494 374652 381468 381788 399297 467312 468764 481599 496574 501014 523729 532454 553930 559538 559784 604682 625977 657071 658192 665238 671558 693443 697...

output:

299863776
256870497
155901846
285180538
147447381
207110951
98697735
231326758
272212054
117038932
200011574
297088082
247204058
255008601
186661768
193689263
59380984
279835693
146736085
282864459
127355425
161264393
151484644
207024065
149031144
109399686
106645095
220739672
58939805
45070425
1304...

result:

ok 500000 lines

Test #13:

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

input:

5000
99974873 99971592 99927454 99927157 99923191 99914011 99896569 99893506 99877437 99838183 99811861 99807926 99792325 99735829 99725143 99671531 99662140 99639579 99635252 99630354 99594256 99590136 99589416 99555070 99551222 99541154 99540619 99535456 99516655 99499083 99487754 99464779 9942131...

output:

299873919
146956783
139271570
200339363
171446108
211671099
234742596
227372655
262766226
124305808
128903631
241545173
225902784
251121444
121566954
134750314
291633314
152703602
298859862
245554170
274941848
233679917
285418418
164829063
294782226
278359779
224416548
63963014
287233122
271749803
1...

result:

ok 500000 lines

Test #14:

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

input:

5000
100000000 34884101 73414392 32254891 83416865 51115376 56941083 88063480 95585432 15068136 51286942 87458497 53021756 12241685 71782503 95443171 5728886 35327860 32995294 35765133 94068250 66983348 60851401 6963189 42004442 71901918 81541138 16933993 27477586 1580713 36891348 51637420 61983187 ...

output:

299990748
296155444
299945989
299990748
299979086
299930188
299208163
299966903
299842772
299979086
299506467
299771620
299930188
299930188
296670287
299789209
299842772
299842772
299930188
299930188
299789209
299990748
299930188
299979086
294416114
299990748
299729656
299979086
297500963
299789209
...

result:

ok 500000 lines

Test #15:

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

input:

5000
53474231 90218965 157304 40772964 79005051 83260403 1381444 91540311 37544988 83619195 14150932 52158269 69180403 88520546 78809044 8763123 65477681 12276692 50894329 98693275 51424540 87654632 56861584 36093622 30879242 80824303 28282330 33525522 40319818 95920965 92018498 67635451 96947809 51...

output:

299999997
298131556
299988693
299911005
299911005
299323967
299562114
299862572
299862572
299827652
299862572
299718170
299778854
299550519
299988693
297797980
299911005
299827652
299939159
299939159
299911005
299910693
299988693
295840362
299862572
299911005
299939159
289833780
272402394
299988693
...

result:

ok 500000 lines

Test #16:

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

input:

5000
6027489 6838647 6131819 6321526 6340905 6173301 6643144 6813423 6820310 6954450 6321512 6435664 6275500 6862646 6509427 6029841 6218532 6420756 6867628 6217639 6845368 6087255 6652762 6432527 6855685 6898066 6697110 6039897 6595856 6097711 6553987 6536626 6637508 6856726 6080976 6452223 6906195...

output:

113998705
20988908
113996964
26990136
113991191
100002000
20975515
100002000
2999
2981
2995
20985733
108997367
100001999
26990136
26984291
108998813
2940
113991191
2977
20996083
26984772
113996964
108998855
100001999
113996964
113991191
20985733
2964
26990136
20871880
113996964
26984772
100001987
11...

result:

ok 500000 lines

Test #17:

score: 0
Accepted
time: 130ms
memory: 33032kb

input:

5000
6345148 6315804 6044919 6005453 6414976 6038897 6343097 6409512 6447157 6496853 6006998 6224079 6441873 6286821 6001519 6466292 6315914 6366812 6017214 6280525 6358330 6185418 6227531 6371949 6272818 6445321 6418227 6192155 6232675 6070593 6047574 6427213 6317199 6120920 6175716 6001280 6247833...

output:

113497167
2988
108995757
100002000
2980
26961124
100001999
19485219
108995757
19479721
100001999
19455433
25719375
112982495
100001999
108995757
2987
2997
3000
2959
26981183
2993
19474949
100001997
2993
19474579
20826534
19485219
2991
19479721
19488551
100001999
19488551
100002000
108995757
2997
100...

result:

ok 500000 lines

Test #18:

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

input:

5000
6117689 6308590 6397844 6096535 6460582 6085179 6158831 6340068 6473781 6093266 6184995 6219838 6406090 6348514 6335372 6465937 6287253 6227333 6392733 6279601 6385000 6030418 6228969 6418740 6322805 6228796 6265847 6016334 6171221 6164205 6188010 6123915 6123092 6174499 6098111 6361114 6059211...

output:

113499511
108999885
2954
108999885
19493332
26990530
2992
100002000
2989
26987920
26990530
26990530
26987920
108994768
26990530
100002000
2629
100002000
112999104
26990530
3000
100002000
100002000
2970
108999885
112999104
2967
26954530
100002000
100002000
3000
112999104
108999885
112999104
100002000...

result:

ok 500000 lines

Test #19:

score: 0
Accepted
time: 132ms
memory: 32852kb

input:

5000
100000000 50005826 28605236 81265024 21867813 26914067 85390615 98170529 48579074 77539166 32625557 80428057 63216837 51361727 95321686 5497533 34051238 10286842 27346810 40574299 69503 24425617 28100905 24494450 47578851 14516654 75254027 12126910 76992600 59707562 45726272 49909942 63535511 9...

output:

300000000
300000000
300000000
300000000
300000000
26947737
300000000
26947737
300000000
300000000
117969580
300000000
300000000
300000000
300000000
300000000
298901819
300000000
300000000
300000000
299154828
20974294
2948
26947737
208989919
300000000
208989919
26947737
300000000
300000000
300000000
...

result:

ok 500000 lines

Subtask #3:

score: 27
Accepted

Test #20:

score: 27
Accepted
time: 65ms
memory: 41236kb

input:

200000
84086285 3877737 90778688 12540402 15311800 39338742 75377725 32470536 90923570 52238111 24575537 27305382 40425713 68605964 1651384 22449714 11936873 98455278 67093520 29769318 55083118 82700926 28626583 35182936 24858847 5367117 79154214 53432312 47417187 98547159 38550908 59573765 82754040...

output:

299992836

result:

ok single line: '299992836'

Test #21:

score: 0
Accepted
time: 38ms
memory: 41828kb

input:

200000
132 980 1066 1876 1878 1878 2668 3269 4513 4866 4945 5440 6052 6117 6944 7201 7799 7811 9654 10443 10823 10851 11256 11261 11291 11353 11399 12059 12781 13141 14300 15022 15951 16927 17086 17265 19076 19260 20075 20214 22594 22687 22762 22948 22986 23109 23938 24700 24944 25519 26338 26364 26...

output:

299997685

result:

ok single line: '299997685'

Test #22:

score: 0
Accepted
time: 41ms
memory: 41756kb

input:

200000
99998742 99997040 99996630 99996271 99996028 99995123 99994785 99994725 99994250 99991569 99990671 99989631 99989154 99989003 99988871 99988641 99988434 99988206 99988195 99986833 99985912 99985836 99984927 99983860 99982212 99981812 99981546 99981319 99981181 99980977 99979097 99977640 99977...

output:

299992412

result:

ok single line: '299992412'

Test #23:

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

input:

200000
100000000 8382009 14090656 50018000 77273170 510042 37815489 53607359 34520837 10552073 54380981 96587490 98066666 13107390 27457092 71493992 15115787 63148252 97168704 4228125 74248839 26080311 44916148 13855554 50066616 44055878 53961459 92616139 71566076 98036628 57810209 52977708 39425689...

output:

299999631

result:

ok single line: '299999631'

Test #24:

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

input:

200000
93370799 17350483 69714607 5095377 90106606 24885044 90512708 31911326 67196085 81032732 39873465 8682093 55337563 92739626 30286857 83428109 15042318 68828926 41570626 91058222 77730437 84292263 2988272 18038802 69605412 11531619 38071963 79457444 2625857 89432186 17358822 85543152 3383189 4...

output:

299999997

result:

ok single line: '299999997'

Test #25:

score: 0
Accepted
time: 79ms
memory: 41180kb

input:

200000
6211207 6325904 6065884 6084924 6025404 6710769 6517330 6282899 6846677 6368157 6627981 6836747 6876750 6976032 6698411 6463766 6757923 6547907 6007319 6141295 6992306 6624650 6481671 6395738 6519319 6786851 6747061 6491792 6099090 6780800 6329228 6055322 6728455 6765514 6816535 6490794 64161...

output:

113999937

result:

ok single line: '113999937'

Test #26:

score: 0
Accepted
time: 70ms
memory: 41268kb

input:

200000
6446381 6487399 6155300 6305855 6185370 6349132 6179086 6079984 6390732 6211624 6023032 6237610 6055924 6321356 6009618 6312044 6253083 6241666 6173207 6047413 6145689 6468221 6049445 6333144 6155699 6025305 6361461 6456947 6293057 6197071 6499278 6092057 6339211 6293424 6104620 6391877 63940...

output:

113499850

result:

ok single line: '113499850'

Test #27:

score: 0
Accepted
time: 70ms
memory: 41332kb

input:

200000
6000476 6384870 6125017 6070693 6231642 6045275 6094825 6393619 6372350 6044172 6470384 6407457 6424740 6109592 6278597 6077837 6236792 6158436 6301541 6009941 6194421 6236417 6015366 6162283 6198389 6410853 6274792 6464348 6206200 6107099 6416964 6471917 6232014 6201971 6445375 6317624 63235...

output:

113499832

result:

ok single line: '113499832'

Test #28:

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

input:

200000
100000000 49409254 63521207 82074040 9286275 67971511 79853920 61181019 4758800 33401562 17760980 49770026 97068871 14728069 76604190 63649231 86826287 46784677 39778161 41376397 6270261 6217967 85565879 43214383 63465989 24619384 14712758 33526939 72611500 45374190 87917376 96780031 36181166...

output:

300000000

result:

ok single line: '300000000'

Subtask #4:

score: 54
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #29:

score: 54
Accepted
time: 496ms
memory: 70324kb

input:

500000
37366495 19709064 84205231 70176527 15089881 35197854 61209736 2814304 15679357 66409063 21095912 38841810 73577539 2211634 17378413 11162511 71168699 34258510 60399053 85913127 73025433 6745456 42362114 55029939 39541541 62131763 26906676 67190541 89093121 65742316 70384933 61241552 88044185...

output:

299999002
299999002
299996975
299886302
299998069
299997192
299995996
299996975
299999002
299998216
299955979
299999002
299989902
299999002
299993955
299998216
299999002
299994257
299997273
299984355
299999002
299998069
291636736
299999002
299923137
299996987
299998216
299999002
299958134
299999002
...

result:

ok 500000 lines

Test #30:

score: 0
Accepted
time: 392ms
memory: 71824kb

input:

500000
759 1245 1905 1955 2319 2562 2848 2899 2974 3115 3230 3656 3822 3849 4041 4178 4304 4685 4847 4890 5219 5743 5750 6387 6492 6722 6980 7043 7368 7646 7661 7683 7912 7962 7999 8002 8169 8432 8462 8702 8825 8990 9095 9393 9674 9891 9906 9928 10164 10334 10389 10775 10783 10925 11182 11441 11894 ...

output:

299997650
51524274
219579977
278148106
238016793
210412920
147010496
166154463
117261300
239232913
70121165
229159248
158803427
222903910
173680242
192518144
206694688
281384319
225904133
133495555
261872968
281334023
296956967
220876294
240051746
114449790
263880046
248893071
91375366
228423452
225...

result:

ok 500000 lines

Test #31:

score: 0
Accepted
time: 410ms
memory: 71740kb

input:

500000
99999989 99999912 99999683 99999535 99999507 99999498 99998407 99998391 99997979 99997911 99997899 99997526 99997499 99997228 99996597 99996569 99996453 99995882 99995789 99994875 99994627 99994412 99993619 99993291 99993224 99993056 99992946 99992934 99992804 99992714 99992385 99992306 99992...

output:

299999584
166023613
238640938
180376722
236689712
298338785
200871214
299088742
151661715
60266691
92942500
255607272
232282746
156965730
278630348
248110919
182708037
148155502
294989406
199134117
238506696
141969753
272666902
114590950
239183868
264811794
231872909
202674324
167936401
93072556
232...

result:

ok 500000 lines

Test #32:

score: 0
Accepted
time: 511ms
memory: 70412kb

input:

500000
100000000 13109218 3952418 26594611 13245127 50055324 12174349 49250509 74162369 75078846 55289937 40358177 10484059 96480762 42491146 79651592 47530699 64263584 79307885 58163292 39974399 42407161 6847418 52426224 18343543 41637400 47917686 45764538 34018238 31540912 41442191 48093237 911111...

output:

299999882
299999769
299994137
299999134
299993710
299999769
299988789
299997644
299999134
299991058
299995103
299999572
299988852
299999769
299984562
299997644
299997644
299999572
299988147
299996744
299999134
299982440
299998411
299997644
299999882
299999769
299960690
299997644
299999882
299978212
...

result:

ok 500000 lines

Test #33:

score: 0
Accepted
time: 512ms
memory: 70332kb

input:

500000
21356641 34178822 16781056 25750501 7357662 32647884 35737315 33124449 13556213 28860552 65450549 31119680 78576756 22673269 5476904 76174392 60367372 4752124 4351270 82683566 25829765 48140443 88417765 53110458 23644289 1843835 86171602 46009104 336810 51494817 88728367 76326214 47078094 736...

output:

299999997
299999961
299999961
299998457
299998854
299978410
299999264
299998234
299999961
299999834
299999223
299989342
299998854
299998400
299998234
299999264
299998928
299992970
299999834
299949145
299999961
299998854
299998946
299999834
299999961
299999264
299999264
299999834
299999264
299999264
...

result:

ok 500000 lines

Test #34:

score: 0
Accepted
time: 489ms
memory: 70336kb

input:

500000
6077595 6965982 6341961 6889546 6918706 6816762 6197257 6043461 6523645 6621347 6894127 6734282 6486047 6594834 6668649 6571228 6848573 6858234 6818623 6733350 6193773 6873133 6599479 6940440 6071118 6022987 6712804 6113655 6350462 6974774 6303144 6106383 6482610 6724935 6721042 6762798 62074...

output:

113999990
109000999
20999974
113999979
26999960
20999648
109000928
20999974
26999562
3000
113999773
20999974
109000999
26999959
20999968
3000
109000999
100002000
109000999
113999990
26999959
109000999
3000
100002000
20999892
26999906
26996449
109000999
3000
26999401
109000999
113999990
26999960
2699...

result:

ok 500000 lines

Test #35:

score: 0
Accepted
time: 538ms
memory: 70428kb

input:

500000
6262904 6065754 6444653 6443579 6310413 6262453 6257108 6491830 6162291 6398374 6462919 6330184 6384103 6235745 6071049 6432398 6365968 6117844 6455336 6074087 6054978 6245471 6241823 6209101 6499376 6145663 6269544 6183361 6235729 6120064 6071266 6488607 6395199 6461139 6129081 6228419 63901...

output:

113499990
26999914
20999241
100002000
109000982
26999914
26999914
100002000
3000
100002000
100002000
100002000
109000982
109000982
100002000
109000596
109000982
3000
2922
26999914
100002000
112999866
100002000
26999914
109000970
3000
100002000
26999914
26999812
109000982
100002000
109000411
10900001...

result:

ok 500000 lines

Test #36:

score: 0
Accepted
time: 525ms
memory: 70340kb

input:

500000
6306957 6418174 6054688 6286030 6272610 6311299 6159778 6062908 6276075 6245479 6420289 6388667 6149443 6085389 6170957 6344178 6329950 6461700 6217675 6263950 6442787 6385073 6089193 6164484 6001124 6144303 6325334 6264968 6488000 6152213 6265654 6161318 6252495 6128687 6153524 6009496 64851...

output:

113499962
109000995
100002000
26999973
19499880
3000
109000995
26999572
112999894
100002000
26999919
109000995
100002000
109000995
100002000
3000
109000995
100002000
3000
26999973
100002000
100002000
3000
100002000
26999973
100002000
100002000
112999929
20999755
26999973
26999973
109000990
3000
3000...

result:

ok 500000 lines

Test #37:

score: 0
Accepted
time: 486ms
memory: 70372kb

input:

500000
100000000 55726935 92399638 96164288 58941971 49901892 56701710 95329233 93322922 43548688 36842574 53707659 45634389 1124765 4738121 99881664 85911702 30244774 72414690 2134359 73273679 15381637 26391704 54738587 73986946 65964107 93431962 57299589 32064395 77052333 18318956 60358843 7915361...

output:

300000000
300000000
26999947
300000000
300000000
26999947
300000000
208999998
300000000
300000000
117999979
200001000
300000000
300000000
299967653
300000000
300000000
117999971
300000000
299935088
299149100
300000000
117999971
300000000
26999873
113999725
300000000
117999904
300000000
100002000
300...

result:

ok 500000 lines

Test #38:

score: 0
Accepted
time: 387ms
memory: 76936kb

input:

500000
100000000 65859706 11150957 90282405 73289135 80747790 5632059 93482681 75200826 58335386 98266733 51881163 43376776 72534118 10995365 38086131 91545930 99124262 1485461 90788111 39059804 23503389 22933006 65611493 71215738 34444267 27348543 17092475 48512176 80799435 9502768 2656843 39640847...

output:

299730688
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
299584564
...

result:

ok 500000 lines

Test #39:

score: 0
Accepted
time: 365ms
memory: 76948kb

input:

500000
80042671 12119064 72463311 75172266 46376909 82909006 10497992 64767568 86168566 72562721 41248816 29164757 94369230 86452904 47463103 92933909 4391646 14002409 84819549 20165899 78804017 68594012 13373778 3173959 4855763 80611079 87297238 82153872 11114860 88276234 56134655 86704159 52235493...

output:

299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
299953901
...

result:

ok 500000 lines

Test #40:

score: 0
Accepted
time: 382ms
memory: 76948kb

input:

500000
6633185 6348126 6323511 6897038 6696362 6504160 6327019 6423729 6061414 6377724 6485715 6883268 6344281 6836867 6197805 6858258 6720844 6955421 6566163 6108774 6257160 6988471 6965982 6210054 6727161 6107440 6463099 6084059 6435048 6983818 6192577 6625862 6985461 6430792 6283761 6019057 63103...

output:

20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
20997104
209...

result:

ok 500000 lines

Test #41:

score: 0
Accepted
time: 350ms
memory: 76944kb

input:

500000
6477401 6242133 6486821 6497252 6152230 6352175 6246615 6356098 6495625 6485155 6241524 6072034 6467839 6009581 6067370 6127605 6065258 6132919 6055922 6139094 6058940 6028959 6379701 6016069 6037704 6042398 6267579 6041986 6181821 6275151 6134693 6363498 6402785 6258867 6376857 6379335 62902...

output:

19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
19498897
194...

result:

ok 500000 lines

Test #42:

score: 0
Accepted
time: 375ms
memory: 76868kb

input:

500000
6368269 6299391 6464750 6466503 6430600 6206655 6187531 6076036 6205065 6315143 6284362 6212745 6336329 6288549 6426139 6279106 6250672 6133157 6267005 6278755 6086006 6411793 6148499 6163575 6035115 6423110 6138461 6364812 6371248 6120403 6032831 6188023 6365812 6479591 6125995 6383997 62634...

output:

19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
19498068
194...

result:

ok 500000 lines

Test #43:

score: 0
Accepted
time: 372ms
memory: 76924kb

input:

500000
100000000 39945649 36076169 73544016 77736669 79355882 44374350 15002069 97408370 8272626 45618942 81310467 22989346 97836450 9920583 422800 33826228 55765391 95987165 96320294 34419842 91784285 3254568 22612689 16458069 91164797 69772219 44007293 6897975 85775226 50140396 60316172 72121050 8...

output:

299930364
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
299821290
...

result:

ok 500000 lines

Test #44:

score: 0
Accepted
time: 388ms
memory: 76256kb

input:

500000
100000000 93965434 20295792 5578344 18635903 22832788 10960039 5107521 40934069 75882082 17118471 51310355 16735553 51640734 10243341 57274486 87167748 47963267 57116631 91651535 49378014 61049128 74737758 71526728 1115636 67225411 60090852 20710348 40409409 38728262 96960180 7228719 57284254...

output:

299968898
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
299957730
...

result:

ok 500000 lines

Test #45:

score: 0
Accepted
time: 389ms
memory: 76280kb

input:

500000
95414697 27555780 81710976 30666888 26717522 36063186 87275626 19149921 12428295 87510887 22884593 65931175 76995758 97212647 17251611 43430573 88859995 45467549 81812722 7112206 28051595 86554818 9234889 84156926 51517900 87811698 46869623 76836191 81366837 77877961 97480552 76960741 6998007...

output:

299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
299967515
...

result:

ok 500000 lines

Test #46:

score: 0
Accepted
time: 403ms
memory: 76396kb

input:

500000
6695246 6757730 6814183 6546717 6156887 6206530 6087949 6722643 6799049 6823803 6817815 6923130 6198658 6675756 6181188 6526568 6371779 6029478 6112885 6436763 6601283 6891720 6722388 6471451 6413620 6456852 6117906 6919484 6005625 6689280 6839700 6105802 6430258 6139853 6699033 6999599 69431...

output:

20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
20999815
209...

result:

ok 500000 lines

Test #47:

score: 0
Accepted
time: 393ms
memory: 76276kb

input:

500000
6155037 6273720 6234538 6467083 6490955 6151100 6040530 6343512 6349416 6482699 6425937 6325472 6075521 6394576 6161504 6478383 6041449 6339043 6332938 6429434 6469469 6475939 6120988 6045157 6450795 6480800 6422872 6412776 6038481 6057561 6456966 6129262 6457939 6042916 6380035 6000255 60317...

output:

19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
19499791
194...

result:

ok 500000 lines

Test #48:

score: 0
Accepted
time: 394ms
memory: 76328kb

input:

500000
6479949 6169325 6259002 6181985 6019210 6204490 6237819 6329230 6095064 6338989 6266872 6112811 6105499 6399940 6095862 6455064 6354595 6376891 6480333 6317423 6460108 6285822 6028895 6195767 6305070 6158519 6330558 6226188 6021260 6204910 6406578 6162154 6067321 6363845 6118171 6170604 61468...

output:

19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
19499778
194...

result:

ok 500000 lines

Test #49:

score: 0
Accepted
time: 384ms
memory: 76368kb

input:

500000
100000000 64913148 72898839 44630299 29487282 49198100 40804260 42424465 79218009 37426890 6823806 17849525 5854392 12802578 26731223 24182299 14777896 38001827 55026356 87833702 69598080 28994450 38893967 78301593 33327345 29649108 44683657 84877621 94075899 61574091 59268297 99071858 559950...

output:

299961323
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
299913709
...

result:

ok 500000 lines

Test #50:

score: 0
Accepted
time: 445ms
memory: 74024kb

input:

500000
100000000 15888970 40131458 95652776 60269748 18402564 43621155 96858462 2886197 99179573 86575968 33944807 65631023 49854951 26641263 23132671 3270270 75890325 16154998 35151620 44317973 51543104 91308232 25613880 99649864 95608959 21503844 40306835 55345531 67650653 29067871 98516583 623819...

output:

299998627
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
299994435
...

result:

ok 500000 lines

Test #51:

score: 0
Accepted
time: 446ms
memory: 74000kb

input:

500000
53476510 96823587 38998207 20729287 98166038 27317148 80408578 31393091 80945221 67786557 93736038 3619107 47031950 80298704 82452361 5040168 37423703 6412077 30150250 90665236 82476597 77027951 19722262 88007424 35999782 51978569 37392931 57783883 73240739 34678609 59822765 76229674 78277926...

output:

299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
299992875
...

result:

ok 500000 lines

Test #52:

score: 0
Accepted
time: 435ms
memory: 74008kb

input:

500000
6054266 6251464 6241614 6908512 6807751 6061615 6038276 6381819 6452754 6120222 6224724 6250935 6594581 6518541 6265261 6492284 6553467 6987926 6928240 6879077 6896244 6505057 6106947 6228597 6887104 6240910 6943900 6928184 6022388 6111686 6498129 6109454 6903617 6441855 6837822 6884112 67409...

output:

20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
20999973
209...

result:

ok 500000 lines

Test #53:

score: 0
Accepted
time: 436ms
memory: 73996kb

input:

500000
6325839 6481084 6247683 6173232 6328475 6128588 6491917 6268763 6187402 6317141 6164599 6001016 6214575 6334079 6424756 6048040 6116365 6414033 6098451 6215798 6153787 6304544 6032413 6099669 6037644 6303578 6446771 6034966 6089355 6031453 6361928 6254018 6020607 6331228 6082376 6307766 62213...

output:

19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
19499859
194...

result:

ok 500000 lines

Test #54:

score: 0
Accepted
time: 466ms
memory: 74024kb

input:

500000
6009518 6305667 6297663 6472075 6254331 6161692 6430862 6124500 6452663 6156354 6479336 6085603 6383540 6243511 6017948 6000923 6461420 6425388 6088017 6330146 6032172 6043827 6466452 6343310 6240966 6387933 6122539 6161562 6156253 6312812 6277172 6497482 6479339 6083242 6162008 6048503 61833...

output:

19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
19499957
194...

result:

ok 500000 lines

Test #55:

score: 0
Accepted
time: 452ms
memory: 73928kb

input:

500000
100000000 95557099 87575697 43648626 84142184 42740389 47932583 38185251 53404570 67073748 46647965 17139216 52393264 83958926 47491285 42015203 9820852 74936206 21180784 55154844 37275357 17591763 85203536 37023965 90598343 20203554 62648809 2492432 25537990 66197162 73427371 18704523 634219...

output:

299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
299999057
...

result:

ok 500000 lines