QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#731204#362. SparklersTheZone100 ✓23ms5504kbC++233.7kb2024-11-10 00:39:192024-11-10 00:39:22

Judging History

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

  • [2024-11-10 00:39:22]
  • 评测
  • 测评结果:100
  • 用时:23ms
  • 内存:5504kb
  • [2024-11-10 00:39:19]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=1e5+1,INF=1e9;
int n,k,T,x[MAXN],e[MAXN];
inline bool check(int v) {
	for(int i=1;i<=n;++i) e[i]=x[i]-2*T*v*i;
	if(e[1]<e[n]) return false;
	int lb=k,rb=k;
	for(int i=k-1;i>=1;--i) if(e[i]>=e[lb]) lb=i;
	for(int i=k+1;i<=n;++i) if(e[i]<=e[rb]) rb=i;
	int l=k,r=k;
	while(lb<l||r<rb) {
		bool ok=false;
		int lp=l;
		while(lb<lp&&e[lp-1]>=e[r]) {
			--lp; if(e[lp]>=e[l]) break;
		}
		if(lp<l&&e[lp]>=e[l]) l=lp,ok=true;
		int rp=r;
		while(rp<rb&&e[rp+1]<=e[l]) {
			++rp; if(e[rp]<=e[r]) break;
		}
		if(rp>r&&e[rp]<=e[r]) r=rp,ok=true;
		if(!ok) return false;
	}
	l=1,r=n;
	while(l<lb||rb<r) {
		bool ok=false;
		int lp=l;
		while(lp<lb&&e[lp+1]>=e[r]) {
			++lp; if(e[lp]>=e[l]) break;
		}
		if(lp>l&&e[lp]>=e[l]) l=lp,ok=true;
		int rp=r;
		while(rb<rp&&e[rp-1]<=e[l]) {
			--rp; if(e[rp]<=e[r]) break;
		}
		if(rp<r&&e[rp]<=e[r]) r=rp,ok=true;
		if(!ok) return false;
	}
	return true;
}
signed main() {
	scanf("%lld%lld%lld",&n,&k,&T);
	for(int i=1;i<=n;++i) scanf("%lld",&x[i]);
	int l=0,r=INF,res=INF;
	while(l<=r) {
		int mid=(l+r)>>1;
		if(check(mid)) res=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%lld\n",res);
	return 0;
}
/*#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=1e5+1,INF=1e9;
int n,k,T,x[MAXN],e[MAXN];
inline bool check(int v) {
	for(int i=1;i<=n;++i) e[i]=x[i]-2*T*v*i;
	if(e[1]<e[n]) return false;
	int lb=k,rb=k;
	for(int i=k-1;i>=1;--i) if(e[i]>=e[lb]) lb=i;
	for(int i=k+1;i<=n;++i) if(e[i]<=e[rb]) rb=i;
	int l=k,r=k;
	while(lb<l||r<rb) {
		bool ok=false;
		int lp=l;
		while(lb<lp&&e[lp-1]>=e[r]) {
			--lp; if(e[lp]>=e[l]) break;
		}
		if(lp<l&&e[lp]>=e[l]) l=lp,ok=true;
		int rp=r;
		while(rp<rb&&e[rp+1]<=e[l]) {
			++rp; if(e[rp]<=e[r]) break;
		}
		if(rp>r&&e[rp]<=e[r]) r=rp,ok=true;
		if(!ok) return false;
	}
	l=1,r=n;
	while(l<lb||rb<r) {
		bool ok=false;
		int lp=l;
		while(lp<lb&&e[lp+1]>=e[r]) {
			++lp; if(e[lp]>=e[l]) break;
		}
		if(lp>l&&e[lp]>=e[l]) l=lp,ok=true;
		int rp=r;
		while(rb<rp&&e[rp-1]<=e[l]) {
			--rp; if(e[rp]<=e[r]) break;
		}
		if(rp<r&&e[rp]<=e[r]) r=rp,ok=true;
		if(!ok) return false;
	}
	return true;
}
signed main() {
	scanf("%lld%lld%lld",&n,&k,&T);
	for(int i=1;i<=n;++i) scanf("%lld",&x[i]);
	int l=0,r=INF,res=INF;
	while(l<=r) {
		int mid=(l+r)>>1;
		if(check(mid)) res=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%lld\n",res);
	return 0;
}#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=1e5+1,INF=1e9;
int n,k,T,x[MAXN],e[MAXN];
inline bool check(int v) {
	for(int i=1;i<=n;++i) e[i]=x[i]-2*T*v*i;
	if(e[1]<e[n]) return false;
	int lb=k,rb=k;
	for(int i=k-1;i>=1;--i) if(e[i]>=e[lb]) lb=i;
	for(int i=k+1;i<=n;++i) if(e[i]<=e[rb]) rb=i;
	int l=k,r=k;
	while(lb<l||r<rb) {
		bool ok=false;
		int lp=l;
		while(lb<lp&&e[lp-1]>=e[r]) {
			--lp; if(e[lp]>=e[l]) break;
		}
		if(lp<l&&e[lp]>=e[l]) l=lp,ok=true;
		int rp=r;
		while(rp<rb&&e[rp+1]<=e[l]) {
			++rp; if(e[rp]<=e[r]) break;
		}
		if(rp>r&&e[rp]<=e[r]) r=rp,ok=true;
		if(!ok) return false;
	}
	l=1,r=n;
	while(l<lb||rb<r) {
		bool ok=false;
		int lp=l;
		while(lp<lb&&e[lp+1]>=e[r]) {
			++lp; if(e[lp]>=e[l]) break;
		}
		if(lp>l&&e[lp]>=e[l]) l=lp,ok=true;
		int rp=r;
		while(rb<rp&&e[rp-1]<=e[l]) {
			--rp; if(e[rp]<=e[r]) break;
		}
		if(rp<r&&e[rp]<=e[r]) r=rp,ok=true;
		if(!ok) return false;
	}
	return true;
}
signed main() {
	scanf("%lld%lld%lld",&n,&k,&T);
	for(int i=1;i<=n;++i) scanf("%lld",&x[i]);
	int l=0,r=INF,res=INF;
	while(l<=r) {
		int mid=(l+r)>>1;
		if(check(mid)) res=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%lld\n",res);
	return 0;
}*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

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

input:

10 9 2
0
1117660
2284171
3390084
3568342
4222750
5180454
6186411
6360445
6519656

output:

181102

result:

ok single line: '181102'

Test #2:

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

input:

3 2 1
0
368765
1493921

output:

373481

result:

ok single line: '373481'

Test #3:

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

input:

9 8 4
0
1970871
2488111
3723411
5581758
7596649
8984403
9989980
10451978

output:

168215

result:

ok single line: '168215'

Test #4:

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

input:

20 18 1
0
462590
635597
1653028
1731039
2632280
2993419
3958675
4824859
4923991
5874922
6721441
7856685
8109245
8187843
8916119
9662776
10617094
11598860
11759660

output:

477159

result:

ok single line: '477159'

Test #5:

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

input:

20 19 1
0
16714
600564
1738550
2860146
3233681
3470376
3511936
4127893
5089595
5771375
5923055
6712524
7645593
7839588
7939256
8270988
8365309
8565641
8764207

output:

242986

result:

ok single line: '242986'

Test #6:

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

input:

20 19 1
0
360130
416278
565928
1137578
1907790
2582414
3700996
4219574
4315031
4708493
5703532
6750886
7008779
7292334
7354499
8425871
8951795
9692673
9903623

output:

318641

result:

ok single line: '318641'

Test #7:

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

input:

20 3 1
0
497352
601758
1175884
1245741
1585758
1746236
2367513
2732420
2739779
3351827
3525038
4143423
4321819
5000239
5107430
5312137
5958753
6370846
6513352

output:

173188

result:

ok single line: '173188'

Test #8:

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

input:

20 7 1
0
416112
1276119
1776741
1971354
3051516
3964787
4752968
5114629
5456785
5783476
6450733
7492246
8117636
8726706
9380206
9424138
9680412
10381694
11143315

output:

394091

result:

ok single line: '394091'

Test #9:

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

input:

20 17 1
0
418275
1609767
2826602
4126911
5045015
5863900
5903447
6048863
6976925
7826789
8397913
8479522
9312544
9618482
9751692
10846799
12065875
12985857
14274374

output:

547554

result:

ok single line: '547554'

Test #10:

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

input:

20 5 1
0
636862
675532
1067405
2149723
2433765
3448119
4927611
5075453
6024114
6742671
7335495
8053680
9461089
10479891
11154362
11537902
11790723
12326305
13349359

output:

374282

result:

ok single line: '374282'

Test #11:

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

input:

20 9 1
0
253324
316843
568058
673961
952771
1319011
1398887
1748830
1895752
2246598
2269716
2344119
2451418
2690003
2985338
3065614
3143399
3495892
3568533

output:

124217

result:

ok single line: '124217'

Test #12:

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

input:

20 11 1
0
51952
61227
162819
249127
306399
334761
382780
449122
509397
542856
610609
616723
637063
646745
686393
770737
862074
908186
946759

output:

25317

result:

ok single line: '25317'

Test #13:

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

input:

20 20 1
0
560429
1501879
2074034
3034586
3927746
4203223
4704487
5719669
6398636
6727143
7650938
8442426
9196467
9374450
9518016
10137750
10914536
11539863
12123154

output:

330901

result:

ok single line: '330901'

Test #14:

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

input:

20 18 1
0
238996
608018
1366723
1785069
2539784
3289307
3602420
4757227
5445099
5644989
6150519
7171436
7964903
9199069
9472670
10160202
11298237
11504431
12150241

output:

374983

result:

ok single line: '374983'

Test #15:

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

input:

20 16 1
0
260310
303643
510297
1043552
1456874
1889988
2034528
2320694
2791007
3106279
3221006
3686585
4034261
4101785
4113243
4346119
4405697
4733785
5087878

output:

139122

result:

ok single line: '139122'

Test #16:

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

input:

20 8 1
0
484204
551742
1091736
1375852
1491742
1695121
2025199
2649991
2689456
3395295
4015308
4099000
4429963
4591520
5011483
5300133
5567208
6302488
6642143

output:

176556

result:

ok single line: '176556'

Test #17:

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

input:

20 6 1
0
62927
133948
189568
367293
532858
671097
693145
766893
880530
939114
944530
1061492
1137014
1312489
1390117
1549261
1657553
1800303
1929758

output:

69120

result:

ok single line: '69120'

Test #18:

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

input:

20 14 1
0
223799
635453
1081261
1241909
1496302
1622006
1780758
1882704
2140804
2503655
2564678
2565246
3012521
3485082
3933129
3986311
4363178
4395662
4701534

output:

223638

result:

ok single line: '223638'

Test #19:

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

input:

20 5 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

output:

0

result:

ok single line: '0'

Test #20:

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

input:

2 1 1
0
1000000000

output:

500000000

result:

ok single line: '500000000'

Test #21:

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

input:

1 1 1
0

output:

0

result:

ok single line: '0'

Subtask #2:

score: 30
Accepted

Dependency #1:

100%
Accepted

Test #22:

score: 30
Accepted
time: 0ms
memory: 3900kb

input:

732 262 7
0
629941
1835167
3075849
3632747
5477365
7690179
11300419
14778007
18359892
20279775
21163002
22029502
23636159
23778620
24102872
27453702
30784655
35027716
36072504
36591660
41988236
46473109
48716186
49542064
50631925
51952471
57334048
61174375
62942938
67795840
70872460
71304388
7568304...

output:

211260

result:

ok single line: '211260'

Test #23:

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

input:

568 176 10
0
4822188
12835213
21145111
24069578
25428693
37689591
44528013
53494376
62691761
74853861
87803170
99563518
103793768
116721590
124706385
130511788
140228697
151031085
156719085
163061026
163972683
168129081
176494838
179979518
193257722
204266763
207017659
212179406
223965988
232681126
...

output:

88184

result:

ok single line: '88184'

Test #24:

score: 30
Accepted
time: 0ms
memory: 3812kb

input:

729 47 4
0
533644
614452
918872
1066928
1633243
2052575
2487683
2677252
2956221
3502185
4032500
4606055
4794447
5434290
5685999
5741100
6004356
6550878
6840957
7439030
7730019
8034922
8440581
8528403
9017686
9170499
9576985
9721356
10115002
10425275
10673108
11300867
11667482
12163892
12313691
12846...

output:

59242

result:

ok single line: '59242'

Test #25:

score: 30
Accepted
time: 1ms
memory: 3840kb

input:

1000 16 1
0
300418
720839
1101334
1270642
1358485
1699613
2031751
2076100
2078250
2167047
2223905
2537060
2672439
2879343
3014590
3445224
3884089
4118024
4432980
4484003
4777108
5200064
5540984
5890142
6227183
6625240
6942951
7338632
7348721
7383868
7709001
7793033
7912649
8267321
8447335
8873296
89...

output:

124746

result:

ok single line: '124746'

Test #26:

score: 30
Accepted
time: 0ms
memory: 3780kb

input:

1000 134 1
0
157000
165508
193836
347260
355223
653813
723441
766606
877569
1153254
1380323
1690537
1975409
2111433
2376749
2665106
2914807
3080873
3485222
3755909
3805411
4001843
4137840
4494580
4805592
5039944
5276573
5561247
5690839
6040123
6111803
6184345
6565504
6885171
6988886
7160962
7455902
...

output:

102156

result:

ok single line: '102156'

Test #27:

score: 30
Accepted
time: 1ms
memory: 3920kb

input:

1000 167 1
0
337310
734264
1228171
1775353
1937515
1966717
2134352
2626557
3090581
3311943
3632694
3760763
4140320
4492696
5133898
5367854
5677466
5879158
6422820
6961196
7515753
8203291
8286108
8479558
8486789
8700986
9096429
9530532
9724870
10239491
10937150
11172992
11835729
12509154
13162049
137...

output:

184550

result:

ok single line: '184550'

Test #28:

score: 30
Accepted
time: 0ms
memory: 3968kb

input:

1000 583 1
0
1155216
2243968
3441256
5297971
6209914
7762324
9015919
9734409
10298287
12090390
13680839
15187680
16616775
17433179
18990924
19345637
20328209
21047781
22310574
23253675
24084243
25052744
26433441
26505138
26771451
27773965
28197193
29214668
29604538
31446792
31634297
33050511
3342317...

output:

507288

result:

ok single line: '507288'

Test #29:

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

input:

1000 648 1
0
149277
558491
833172
1061298
1159483
1289104
1512423
1829467
1932459
2206872
2427755
2682759
2982638
3167870
3203058
3379660
3581887
3642593
4001751
4241647
4652799
4829201
5197712
5208113
5569955
5587313
5858867
6044105
6335886
6640171
6724803
6804688
7017976
7450352
7879658
8063683
84...

output:

135848

result:

ok single line: '135848'

Test #30:

score: 30
Accepted
time: 1ms
memory: 3916kb

input:

1000 795 1
0
686899
726596
1248874
1493856
3062405
3640995
4212376
5570483
6826974
7121530
7833336
7901177
9464878
10585555
11892848
12528701
13269468
14456032
15998686
16803364
17796407
17884537
18272340
18495999
19828084
21233255
22510945
23456317
23827759
25261874
25370977
25481392
26520168
27639...

output:

470218

result:

ok single line: '470218'

Test #31:

score: 30
Accepted
time: 1ms
memory: 3920kb

input:

1000 759 1
0
292968
1286267
2746799
3008098
3957531
4083400
4553850
4986193
5454234
6032115
7233640
8832257
9344907
10846015
12427055
13269890
13699022
14707280
16218583
17252404
17774007
18676352
19819174
19838334
20655789
21327375
21561066
21565972
22261363
23332536
23645399
25210904
26335730
2763...

output:

554416

result:

ok single line: '554416'

Test #32:

score: 30
Accepted
time: 0ms
memory: 3784kb

input:

1000 458 1
0
504827
848739
1086846
1573082
1728990
1823619
2014935
2220271
2557191
3044420
3330136
3678193
4215244
4491655
4635399
4825647
5307762
5723073
6193581
6343163
6412549
6939317
7448527
7653234
8109406
8247186
8694349
9107982
9256817
9308402
9897870
10061482
10680266
11210653
11660005
11804...

output:

157794

result:

ok single line: '157794'

Test #33:

score: 30
Accepted
time: 0ms
memory: 3880kb

input:

1000 456 1
0
443096
828592
853300
2166760
3763688
4474083
5605059
5924755
6028046
7560910
9185540
9439212
10435851
11748693
12592624
13982847
15349361
15813754
16470798
16918094
17846923
18854493
19038890
20646465
21723048
22912066
23442080
24187299
24764257
25671485
27317603
28811914
29024954
30682...

output:

427924

result:

ok single line: '427924'

Test #34:

score: 30
Accepted
time: 0ms
memory: 3832kb

input:

1000 853 1
0
582236
707105
1485183
1565456
2305904
2945856
3588155
3639466
3983620
4616508
5234636
5253012
5318842
5973684
6450836
7271793
7564151
7828478
8062226
8365405
9058247
9229188
9935587
10236602
10498734
10859622
11459300
11790218
11802398
12225935
12315792
12739191
13278401
13767688
138153...

output:

216536

result:

ok single line: '216536'

Test #35:

score: 30
Accepted
time: 0ms
memory: 3900kb

input:

1000 678 1
0
1423965
1720061
2770130
3164514
4617891
4997811
5376811
6259000
6374700
7470084
8144917
8322317
9000489
10446643
11863354
13237339
14715403
16069900
16610423
17007435
17434598
17563153
18434143
19847695
20451294
20754484
20996075
21921238
22485230
22769421
22889959
23834563
25066889
251...

output:

391962

result:

ok single line: '391962'

Test #36:

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

input:

1000 79 1
0
146771
587793
895168
1125168
1335036
1452933
1526650
1918223
2012769
2582329
3104377
3194601
3300365
3442735
3461648
3982416
4296813
4857404
4920820
5369944
5920776
6374534
6792185
6999303
7246112
7728670
8213772
8686243
8874923
8977574
9463313
9471641
9583689
9890568
10222513
10395290
1...

output:

253173

result:

ok single line: '253173'

Test #37:

score: 30
Accepted
time: 1ms
memory: 3820kb

input:

1000 80 1
0
8138
16097
55052
132991
173831
191917
291217
349204
387976
510410
538297
566672
684616
763244
787637
872089
996937
1099484
1222638
1282821
1406083
1530218
1560976
1622871
1740617
1831309
1868920
1940406
2016359
2041718
2176541
2311739
2434375
2484665
2541798
2626695
2666664
2684068
26903...

output:

40462

result:

ok single line: '40462'

Test #38:

score: 30
Accepted
time: 1ms
memory: 3912kb

input:

1000 696 1
0
287744
552034
1939818
2810607
3742043
4697514
6394294
6952380
7749944
8885258
9610948
10729116
11520305
11842566
13495115
14422538
15759779
16950184
17730382
18723101
19644608
20937824
22314327
23483431
24832581
25116142
26646011
27722092
29174150
29817352
31121574
32062527
33269915
335...

output:

509406

result:

ok single line: '509406'

Test #39:

score: 30
Accepted
time: 1ms
memory: 3924kb

input:

1000 946 1
0
321611
583133
948259
1393880
1500586
1817398
2169635
2570310
3022668
3464202
3619114
4306711
5208482
5807290
6072910
6553270
7162827
7731663
8862192
9108146
10221512
11221274
12152335
12304641
12874083
13391968
13881281
14409814
14949312
14998383
16001073
16039140
16428078
17264220
1761...

output:

337421

result:

ok single line: '337421'

Test #40:

score: 30
Accepted
time: 0ms
memory: 3968kb

input:

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

output:

0

result:

ok single line: '0'

Subtask #3:

score: 50
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #41:

score: 50
Accepted
time: 8ms
memory: 4780kb

input:

64944 48942 10
0
132465
271583
422988
502187
616524
781356
971483
1147338
1201136
1209297
1270299
1457035
1547500
1588836
1737679
1861812
1861942
1901796
2089337
2273423
2299172
2409479
2564115
2578298
2635887
2711417
2787082
2855980
2873745
2890630
3061756
3123156
3138851
3214185
3271978
3387891
35...

output:

770

result:

ok single line: '770'

Test #42:

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

input:

2544 281 1
0
13570
15088
28249
36255
45228
62179
72750
86758
103113
114107
131223
141045
143547
154723
164061
164235
170037
172113
188776
199968
207329
209111
213786
224815
227824
242863
252776
258322
264369
268191
275815
276927
288910
291212
305052
307999
308599
311270
319887
330210
338481
344210
3...

output:

5144

result:

ok single line: '5144'

Test #43:

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

input:

18415 12647 10
0
160166
309369
442188
538258
547315
732840
893693
1054182
1227007
1319585
1448113
1469386
1478740
1606374
1748696
1865136
1917827
1996876
2120441
2299781
2455034
2467452
2615635
2656844
2818626
2836288
2870353
2915415
2964175
3040687
3222809
3331537
3390063
3543142
3674063
3702136
37...

output:

2716

result:

ok single line: '2716'

Test #44:

score: 50
Accepted
time: 20ms
memory: 5320kb

input:

100000 9658 1
0
3399
13257
14737
22743
34296
48139
56795
56994
62660
65829
67953
79213
92194
106575
109473
121648
122496
134931
138418
147891
152601
159683
165707
177526
187356
198293
201781
202208
207495
220441
225027
238653
245350
246364
253877
258948
270098
280392
287306
287578
299075
301003
3136...

output:

3664

result:

ok single line: '3664'

Test #45:

score: 50
Accepted
time: 18ms
memory: 5376kb

input:

100000 59656 1
0
7722
8317
12936
23987
26603
28924
32002
43990
48716
56788
63735
76440
82757
88939
103406
116725
121833
133131
138587
140314
142266
149975
154050
158761
172339
179549
189336
195167
199204
201201
204116
212645
222956
225760
229544
238257
245296
250283
263107
270607
277041
290573
29971...

output:

3645

result:

ok single line: '3645'

Test #46:

score: 50
Accepted
time: 20ms
memory: 5444kb

input:

100000 25736 1
0
2522
8769
10999
14670
21433
26845
30555
32165
34117
40734
48425
53415
57667
62192
66370
68997
81632
93274
106213
108431
118145
122654
125375
131882
132589
143973
150772
161349
169762
172640
179326
180157
191858
202556
206752
211595
220976
226382
238834
240445
247130
254344
259180
26...

output:

3522

result:

ok single line: '3522'

Test #47:

score: 50
Accepted
time: 21ms
memory: 5468kb

input:

100000 29764 1
0
8799
14838
20976
23706
28748
30292
32544
32726
38720
49676
56557
67275
74917
75429
82847
83963
87688
88277
90034
100491
101437
103154
106472
119445
125730
126810
133647
139330
143609
144438
150482
153223
158342
167814
176602
177103
188883
190907
203274
210508
215409
226372
233792
24...

output:

3967

result:

ok single line: '3967'

Test #48:

score: 50
Accepted
time: 19ms
memory: 5436kb

input:

100000 41494 1
0
937
4251
10800
15482
27988
31125
37522
44018
53078
62711
63065
70356
79482
81269
84974
91143
100911
107544
111602
122276
124828
135799
141828
150755
152697
160040
162445
171750
176339
185264
191444
192038
198622
204214
214441
226338
228539
235097
245277
256414
266132
270675
274330
2...

output:

3375

result:

ok single line: '3375'

Test #49:

score: 50
Accepted
time: 16ms
memory: 5384kb

input:

100000 1285 1
0
6815
14744
23158
36314
44346
57916
70631
80233
91781
103786
107674
108668
120416
122836
128348
129330
134179
149551
162387
177491
178927
187192
203767
210433
217427
230736
245119
246792
258157
266384
282669
286018
299378
314442
326832
333614
346713
358822
373298
383832
387956
400592
...

output:

4243

result:

ok single line: '4243'

Test #50:

score: 50
Accepted
time: 18ms
memory: 5400kb

input:

100000 54471 1
0
1715
1987
9454
14492
22471
33246
44585
45256
46266
57725
69722
76135
82348
82519
92263
104344
106772
118484
123987
134096
143558
152430
157803
166112
173195
174318
177128
185124
185960
191918
194033
194106
199587
208281
210967
215770
225254
229985
234340
239157
242914
246909
256315
...

output:

3415

result:

ok single line: '3415'

Test #51:

score: 50
Accepted
time: 16ms
memory: 5504kb

input:

100000 22383 1
0
10693
25495
38597
48347
54073
54952
62299
78670
96952
111408
113110
131568
147135
155450
158662
172304
173608
180327
193746
211299
220581
221110
232697
237996
239488
257804
265524
269229
275447
290679
296448
307957
314298
317680
335941
336997
341182
354033
369793
382904
395344
41083...

output:

5021

result:

ok single line: '5021'

Test #52:

score: 50
Accepted
time: 18ms
memory: 5464kb

input:

100000 79552 1
0
3930
6951
15219
17132
27175
33369
48609
53242
69440
84744
99445
99562
105155
108550
122737
139531
149008
165901
175200
176714
182152
184458
199567
210179
216175
231525
234639
241343
244306
251885
251973
262979
265605
268337
270821
279441
282677
294172
300783
313242
330195
344903
353...

output:

4736

result:

ok single line: '4736'

Test #53:

score: 50
Accepted
time: 17ms
memory: 5496kb

input:

100000 7829 1
0
9603
12834
23200
34236
40615
56576
58079
72881
80077
93420
110046
113218
120986
136059
140411
156984
165096
180241
197403
210879
226399
234293
251476
269210
284784
285579
291909
301311
304346
316569
317572
335072
338752
341190
345172
346696
353902
363288
363402
380621
382052
387893
4...

output:

4792

result:

ok single line: '4792'

Test #54:

score: 50
Accepted
time: 20ms
memory: 5464kb

input:

100000 76152 1
0
5427
6728
11177
16657
25454
37507
41069
46834
51967
57289
69923
73213
81721
94292
102440
110538
116789
122109
128123
130349
133021
139115
140377
148463
155210
160732
164976
175428
179145
186414
194125
194643
199722
206727
215316
221539
231780
237373
245251
255131
265643
276101
28131...

output:

5369

result:

ok single line: '5369'

Test #55:

score: 50
Accepted
time: 18ms
memory: 5324kb

input:

100000 58433 1
0
130
7683
12035
21133
32284
38017
51279
51492
58996
67935
81188
89745
99494
103395
111429
121034
125958
133451
138517
138576
149250
151720
162284
172425
179707
182959
195019
196300
202638
205723
213847
214646
220327
225094
228525
235445
236909
241066
244674
246724
248809
260764
27048...

output:

3331

result:

ok single line: '3331'

Test #56:

score: 50
Accepted
time: 19ms
memory: 5376kb

input:

100000 17487 1
0
8941
15544
26711
32035
40231
43486
49400
60634
71502
76084
86792
90379
98116
100122
101146
106886
111287
115004
115348
117903
124725
132080
141276
142063
149470
151672
153743
165979
168425
175656
184199
191263
198213
204748
215508
220860
233138
241130
252132
263031
268733
273982
280...

output:

3271

result:

ok single line: '3271'

Test #57:

score: 50
Accepted
time: 23ms
memory: 5324kb

input:

100000 91374 1
0
10047
21221
31942
39881
42697
51444
57155
64248
74534
79782
88078
88180
98410
108234
108959
113868
114240
123310
127708
139166
149236
152897
162621
167390
172517
181217
189248
191320
194711
200456
203474
215878
224839
236809
247589
253353
260000
271963
281794
289346
291324
295629
30...

output:

3465

result:

ok single line: '3465'

Test #58:

score: 50
Accepted
time: 18ms
memory: 5380kb

input:

100000 42524 1
0
5664
12767
24051
26008
36078
40934
50416
61374
62881
74906
78304
87219
94567
95229
104039
108206
113870
119540
130645
136953
145744
155768
157081
162365
171057
176822
179873
191440
203717
208954
213852
218135
222154
228671
239544
245434
253143
254578
261799
268010
278566
286673
2947...

output:

3715

result:

ok single line: '3715'

Test #59:

score: 50
Accepted
time: 13ms
memory: 5376kb

input:

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

output:

0

result:

ok single line: '0'

Test #60:

score: 50
Accepted
time: 18ms
memory: 5320kb

input:

100000 80530 1
0
123
130
399
460
506
555
924
1017
1083
1520
1551
1609
1689
1812
1814
1815
2312
2510
2948
2973
2978
2999
3148
3291
3356
3529
3561
3608
3611
3658
3705
3748
3784
3800
3941
4154
4227
4343
4410
4562
4754
4786
4806
4825
5002
5047
5078
5103
5107
5209
5300
5352
5392
5469
5621
5801
5900
6007
...

output:

2907

result:

ok single line: '2907'

Test #61:

score: 50
Accepted
time: 18ms
memory: 5356kb

input:

100000 71445 1
0
10
64
71
163
230
281
484
524
623
651
656
759
779
790
821
1070
1121
1179
1221
1320
1552
1600
1860
2113
2303
2337
2355
2475
2513
2553
2560
2933
2993
3002
3065
3202
3251
3275
3324
3357
3434
3560
3661
3662
3717
3740
3793
4043
4148
4364
4407
4420
4499
4579
4596
4739
4790
5248
5308
5349
5...

output:

552

result:

ok single line: '552'

Test #62:

score: 50
Accepted
time: 19ms
memory: 5468kb

input:

100000 18513 1
0
159
372
420
436
724
1017
1091
1098
1106
1162
1238
1252
1285
1481
1941
2180
2221
2250
2272
2298
2537
2541
2640
2852
2993
3048
3121
3188
3501
3554
3592
3640
3698
3723
3910
4039
4079
4097
4161
4244
4424
4517
4820
4839
4891
4925
4967
5047
5214
5386
5442
5533
5547
5589
5814
6120
6531
660...

output:

3368

result:

ok single line: '3368'

Test #63:

score: 50
Accepted
time: 17ms
memory: 5456kb

input:

100000 70429 1
0
53
56
84
441
824
860
862
970
1120
1124
1235
1749
1800
1867
1870
1888
1891
2142
2155
2276
2476
2744
2882
2974
3008
3444
3696
3726
3868
4019
4022
4037
4056
4119
4200
4242
4380
4447
4547
5281
5285
5513
5530
5538
5737
5801
5831
5864
5873
5888
5951
6010
6100
6107
6304
6358
6391
6452
6581...

output:

3075

result:

ok single line: '3075'

Test #64:

score: 50
Accepted
time: 13ms
memory: 5504kb

input:

100000 65139 1
0
108
135
225
359
375
394
413
541
695
929
1072
1213
1229
1338
1422
1435
1517
1560
1616
1726
1756
1767
1921
1936
2049
2289
2299
2635
2673
2912
3201
3219
3395
3468
3473
3534
3632
3710
3916
3986
4087
4163
4295
4347
4438
4440
4586
4634
4663
4667
4710
5097
5236
5451
5452
5584
5717
5833
590...

output:

3468

result:

ok single line: '3468'

Test #65:

score: 50
Accepted
time: 17ms
memory: 5496kb

input:

100000 41323 1
0
26
135
269
599
721
871
988
1180
1324
1374
1622
1833
1895
1951
2095
2214
2227
2253
2403
2471
2499
2654
2719
2723
2733
2850
2956
3004
3052
3135
3255
3351
3438
3724
3726
3753
3820
3823
3882
3901
4009
4025
4173
4213
4407
4812
4830
4856
4969
5103
5192
5208
5333
5362
5559
5873
5946
6325
6...

output:

3611

result:

ok single line: '3611'

Test #66:

score: 50
Accepted
time: 17ms
memory: 5460kb

input:

100000 53871 1
0
13
178
179
558
615
804
880
900
1119
1129
1149
1257
1330
1483
1568
1695
1836
1895
1938
2307
2501
2561
2918
2978
3110
3260
3382
3386
3444
3463
3536
3548
3566
3608
3658
3925
3945
3974
3994
3996
3997
4080
4131
4191
4316
4342
4379
4603
4689
4718
4828
5053
5124
5186
5349
5375
5604
5719
58...

output:

1268

result:

ok single line: '1268'

Test #67:

score: 50
Accepted
time: 17ms
memory: 5320kb

input:

100000 34748 1
0
116
150
235
279
386
463
503
828
867
897
928
1133
1137
1207
1217
1264
1349
1669
1706
1881
1997
2017
2060
2073
2079
2082
2210
2290
2438
2519
2750
2773
2778
2817
2832
2861
3006
3081
3086
3167
3373
3444
3538
3641
3729
3817
4177
4242
4263
4281
4322
4368
4404
4518
4793
4806
4876
4998
5183...

output:

3292

result:

ok single line: '3292'

Test #68:

score: 50
Accepted
time: 17ms
memory: 5320kb

input:

100000 76913 1
0
45
261
355
434
509
556
578
690
751
1392
1461
1472
1493
1615
1704
1764
1788
1975
2232
2272
2291
2376
2424
2544
2605
2728
2788
2799
2806
2811
2812
2893
2989
3002
3125
3204
3283
3295
3476
3509
4015
4016
4043
4088
4273
4520
4717
4767
4775
4930
5007
5058
5108
5165
5170
5423
5449
5707
574...

output:

2661

result:

ok single line: '2661'

Test #69:

score: 50
Accepted
time: 17ms
memory: 5444kb

input:

100000 80617 1
0
74
95
167
520
537
566
580
601
711
734
938
1014
1090
1116
1122
1147
1228
1261
1361
1370
1403
1483
1583
1703
1811
1866
1872
2111
2113
2147
2157
2245
2300
2682
3042
3058
3267
3275
3300
3348
3361
3705
3748
3961
4038
4217
4254
4351
4454
4728
4747
4796
4955
4980
5306
5378
5390
5391
5476
5...

output:

1724

result:

ok single line: '1724'

Extra Test:

score: 0
Extra Test Passed