QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#420446#8641. Ski 2flying42 1826ms5484kbC++141.5kb2024-05-24 18:21:542024-05-24 18:21:55

Judging History

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

  • [2024-05-24 18:21:55]
  • 评测
  • 测评结果:42
  • 用时:1826ms
  • 内存:5484kb
  • [2024-05-24 18:21:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long

const int N=305;

int a[N], cost[N], pos[N], sum[N], Min[N];
int dp1[N][N], dp2[N][N];
map <int,int> cnt, have, Mincost;

signed main()
{
	int n,m,K;
	cin >> n >> K;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld %lld",&a[i],&cost[i]);
		cnt[a[i]]++;
		have[a[i]]++;
		if(have[a[i]]>1)
			Mincost[a[i]]=min(Mincost[a[i]],cost[i]);
		else
			Mincost[a[i]]=cost[i];

		int pos=a[i];
		while(cnt[pos]>=2)
		{
			cnt[pos]--;
			pos++;
			cnt[pos]++;
		}
	}

	int indx=0;
	for(auto x:cnt)
		pos[++indx]=x.first;
	n=indx;

	Min[0]=1e12;
	for(int i=1;i<=n;i++)
	{
		a[i]=have[pos[i]];
		if(a[i])
		{
			sum[i]=sum[i-1]+a[i];
			Min[i]=min(Min[i-1],Mincost[pos[i]]);
		}
		else
			sum[i]=sum[i-1], Min[i]=Min[i-1];
	}

	memset(dp2,0x3f,sizeof(dp2));
	dp2[0][1]=0;
	for(int i=1;i<=n;i++) //目前到第i层
	{
		memset(dp1,0x3f,sizeof(dp1));
		for(int cnt=a[i];cnt<=sum[i];cnt++)
			for(int Max=1;Max<=sum[i];Max++)
				dp1[cnt][Max]=dp2[cnt-a[i]][Max];

		memset(dp2,0x3f,sizeof(dp2));
		for(int cnt=0;cnt<=sum[i];cnt++)
			for(int Max=1;Max<=sum[i];Max++)
			{
				for(int j=0;j<=Max;j++)
				{
					if(cnt+j<=sum[i])
						dp2[cnt][Max]=min(dp2[cnt][Max],dp1[cnt+j][Max]);

					if(cnt+Max<=sum[i])
						dp2[cnt][Max]=min(dp2[cnt][Max],dp1[cnt+Max][j]+(Max-j)*Min[i-1]);
				}
				dp2[cnt][Max] += cnt*K;
			}
	}

	int ans=0x3f3f3f3f3f3f3f3f;
	for(int i=1;i<=n;i++)
		ans=min(ans,dp2[0][i]);
	printf("%lld\n",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 5
Accepted
time: 1234ms
memory: 5484kb

input:

300 987761245
249 97
279 38
52 53
190 2
294 46
170 93
260 70
273 6
49 4
32 71
188 28
212 10
253 86
187 46
167 27
32 75
226 90
86 17
172 24
129 70
291 78
189 98
97 98
256 19
228 36
240 86
240 63
269 21
81 81
41 25
155 49
279 12
176 49
136 25
260 95
271 90
202 79
299 36
79 53
297 59
46 92
202 19
125 3...

output:

144

result:

ok single line: '144'

Test #2:

score: 5
Accepted
time: 1781ms
memory: 5360kb

input:

300 451766134
225 3
78 77
144 26
211 37
119 39
126 65
7 47
53 7
121 37
52 60
212 24
168 60
212 42
104 45
218 4
146 42
234 25
43 83
126 67
128 61
125 80
87 62
113 8
71 28
148 80
175 34
126 77
295 91
35 62
265 31
35 29
108 8
195 34
85 59
250 41
78 62
242 17
178 80
34 15
187 60
94 34
50 25
144 29
10 8
...

output:

103

result:

ok single line: '103'

Test #3:

score: 5
Accepted
time: 1527ms
memory: 5364kb

input:

300 584296612
252 63
248 8
136 92
181 38
206 77
229 21
196 84
7 86
187 29
170 42
195 10
148 100
279 2
113 65
22 18
148 68
11 14
187 72
133 59
205 7
155 95
251 76
300 18
265 19
76 59
59 76
86 7
73 84
101 49
19 47
25 70
24 44
29 75
112 77
128 27
28 27
198 29
148 56
128 89
218 26
177 13
117 84
25 91
0 ...

output:

1168593404

result:

ok single line: '1168593404'

Test #4:

score: 5
Accepted
time: 1826ms
memory: 5344kb

input:

300 542226210
235 86
10 24
160 95
40 31
293 60
285 77
285 97
24 83
26 70
254 50
136 68
112 23
84 28
236 41
101 49
70 94
282 6
231 57
199 51
146 39
55 54
192 47
192 66
72 74
186 96
136 42
72 13
282 18
296 53
127 46
16 75
241 84
146 52
241 62
231 5
143 46
40 35
105 69
126 31
252 3
101 16
154 33
30 100...

output:

125

result:

ok single line: '125'

Test #5:

score: 5
Accepted
time: 1683ms
memory: 5300kb

input:

300 851059749
59 76
266 2
7 58
202 53
214 58
256 30
99 28
224 16
64 80
150 93
12 14
278 15
196 7
259 97
13 27
256 100
66 90
257 26
85 44
49 64
171 63
266 37
95 44
123 75
203 41
261 89
81 30
65 51
64 42
66 45
108 10
198 45
128 86
234 49
199 77
65 37
234 52
246 8
198 12
50 3
181 71
218 83
66 85
261 73...

output:

851059869

result:

ok single line: '851059869'

Test #6:

score: 5
Accepted
time: 1751ms
memory: 5376kb

input:

300 947403587
92 86
43 91
295 85
105 15
236 78
295 66
11 82
72 54
69 76
145 17
224 66
19 35
249 75
21 92
99 85
38 61
222 81
145 68
14 60
21 23
38 97
133 63
257 6
139 64
295 34
133 80
157 29
57 33
38 9
155 31
102 77
191 98
201 87
255 85
203 38
242 54
38 78
242 59
159 81
26 56
43 82
102 83
14 94
36 87...

output:

947404177

result:

ok single line: '947404177'

Test #7:

score: 0
Time Limit Exceeded

input:

300 363080349
19 96
23 83
20 86
22 86
7 93
12 100
21 79
14 92
15 90
19 91
23 96
16 89
20 84
8 100
22 79
21 94
20 85
19 88
11 100
22 90
22 80
2 99
23 89
21 84
23 80
8 96
9 96
23 88
17 93
16 84
11 95
22 90
18 86
11 92
19 81
18 88
9 92
12 97
4 98
17 89
23 95
5 99
10 93
18 89
10 97
16 91
8 97
16 85
20 8...

output:


result:


Subtask #2:

score: 0
Time Limit Exceeded

Test #9:

score: 0
Time Limit Exceeded

input:

300 1
0 6596366
1 195480684
2 39457151
1 832234727
1 462764495
2 81049898
0 487070027
1 430671894
2 721333033
1 615885993
1 842070560
1 592116125
2 840818824
0 544935711
2 333187430
2 467111553
0 416912849
2 159079860
0 478546939
0 593053374
0 876528192
2 9215174
1 93255151
2 120891934
0 10339332
2 ...

output:


result:


Subtask #3:

score: 9
Accepted

Test #20:

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

input:

10 849097758
4 937762392
10 817247459
0 440668594
1 912982987
7 663812156
7 594886472
0 837105766
2 737473115
3 649275922
10 873042888

output:

1289766352

result:

ok single line: '1289766352'

Test #21:

score: 9
Accepted
time: 3ms
memory: 5304kb

input:

10 9998
5 878445115
0 949971639
4 896709623
3 782518625
0 763551803
2 795919483
10 820305225
7 955019709
0 988957902
6 794013355

output:

89982

result:

ok single line: '89982'

Test #22:

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

input:

10 313931642
1 752682337
6 864853209
7 172291208
3 849996643
9 462903663
3 806832309
7 415016851
7 200488544
2 936575125
4 772486850

output:

1066613979

result:

ok single line: '1066613979'

Test #23:

score: 9
Accepted
time: 3ms
memory: 5392kb

input:

10 374
3 962058719
9 752701033
9 645570821
7 985449153
7 578273422
3 804266379
5 854354117
4 993866589
9 911208632
4 975880747

output:

5610

result:

ok single line: '5610'

Test #24:

score: 9
Accepted
time: 3ms
memory: 5400kb

input:

10 324770512
10 375908339
1 411213202
4 392519015
8 901521995
5 421608634
9 705664450
3 592078552
6 633681433
0 534389104
10 683380690

output:

324770512

result:

ok single line: '324770512'

Test #25:

score: 9
Accepted
time: 2ms
memory: 5296kb

input:

10 108923
10 120608144
6 991122545
10 591398529
6 777899046
1 904193758
9 944103839
7 642544838
4 688262357
1 953425951
10 190058178

output:

653538

result:

ok single line: '653538'

Test #26:

score: 9
Accepted
time: 3ms
memory: 5392kb

input:

10 932546022
9 38744232
1 995739974
2 998741663
6 847774949
2 996519521
5 866539522
7 526895946
10 8709873
4 996793074
6 844393176

output:

995739974

result:

ok single line: '995739974'

Test #27:

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

input:

10 11953563
0 994878622
3 906206994
1 915019718
1 864107053
0 999397042
6 581277066
3 676038157
10 83264360
0 996754561
7 229761931

output:

179303445

result:

ok single line: '179303445'

Test #28:

score: 9
Accepted
time: 2ms
memory: 5296kb

input:

10 714566765
6 565233644
1 749146469
8 190842124
7 505680950
7 199148424
5 664206601
8 858960166
2 706982967
9 17885105
0 789061662

output:

565233644

result:

ok single line: '565233644'

Test #29:

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

input:

10 2706858
8 20780016
2 612818354
3 550413138
1 565798966
5 236857307
4 422818113
6 141418944
0 660351593
7 74422537
5 669426759

output:

10827432

result:

ok single line: '10827432'

Test #30:

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

input:

10 79131102
3 561812059
10 629590644
0 775921462
3 65546214
4 47956310
6 9533026
6 413541633
10 724465012
3 978513343
1 717560726

output:

289354632

result:

ok single line: '289354632'

Test #31:

score: 9
Accepted
time: 3ms
memory: 5256kb

input:

10 83256
6 698120
3 1534802
8 437707384
5 212414104
7 468360049
4 878752
1 981212200
10 272656828
2 719985274
10 752429067

output:

83256

result:

ok single line: '83256'

Test #32:

score: 9
Accepted
time: 3ms
memory: 5368kb

input:

10 1
5 14274
2 570420826
5 355150629
6 357632129
8 528001647
7 934027175
6 481321503
4 1273104
6 3094
1 814868110

output:

13

result:

ok single line: '13'

Test #33:

score: 9
Accepted
time: 2ms
memory: 5308kb

input:

10 2873864
10 977169433
10 847905313
10 124227633
10 549266764
0 236666415
10 890433448
10 661097582
10 564499162
10 343958722
10 854023415

output:

103459104

result:

ok single line: '103459104'

Test #34:

score: 9
Accepted
time: 3ms
memory: 5396kb

input:

10 1000000000
10 508707288
10 58470524
10 321845938
10 323290860
10 776749224
0 1000000000
10 137965772
10 524047258
10 180390059
10 713703265

output:

8000000000

result:

ok single line: '8000000000'

Test #35:

score: 9
Accepted
time: 2ms
memory: 5300kb

input:

10 226214084
8 824556953
8 508286392
8 477565118
8 145272502
8 540447972
8 460840516
8 206666089
8 591816141
8 254840354
8 927809299

output:

3198106772

result:

ok single line: '3198106772'

Test #36:

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

input:

10 10
9 420719880
9 174634535
9 936752657
9 381266133
9 833058617
9 372254594
9 794099768
9 388422457
9 540952494
9 456683771

output:

450

result:

ok single line: '450'

Test #37:

score: 9
Accepted
time: 2ms
memory: 5256kb

input:

10 24
10 840795537
10 863928462
10 786445929
10 613005621
10 931415607
10 658396805
10 900315095
10 500448499
10 565668068
10 999965883

output:

1080

result:

ok single line: '1080'

Test #38:

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

input:

10 35179030
2 869884177
2 957349278
0 979089717
2 874549497
3 940925611
3 727713012
0 960781959
3 724210350
3 988081346
1 897834835

output:

914654780

result:

ok single line: '914654780'

Test #39:

score: 9
Accepted
time: 2ms
memory: 5372kb

input:

10 106
0 424
0 212
0 318
0 530
0 954
0 742
0 636
0 1060
0 106
0 848

output:

1802

result:

ok single line: '1802'

Test #40:

score: 9
Accepted
time: 2ms
memory: 5388kb

input:

10 121
0 1936
0 1694
1 726
0 2420
0 1452
1 484
1 1210
1 968
1 242
0 2178

output:

2662

result:

ok single line: '2662'

Test #41:

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

input:

10 172
2 1032
2 516
0 3612
0 4128
1 2580
0 4644
0 5160
1 2064
1 3096
2 1548

output:

4472

result:

ok single line: '4472'

Test #42:

score: 9
Accepted
time: 2ms
memory: 5312kb

input:

1 685041057
4 990761589

output:

0

result:

ok single line: '0'

Subtask #4:

score: 33
Accepted

Dependency #3:

100%
Accepted

Test #43:

score: 33
Accepted
time: 5ms
memory: 5312kb

input:

40 775287934
15 627598219
0 879640425
2 583623769
28 674296588
8 742162320
40 709091851
37 567907921
34 577543751
0 733598362
23 583109809
31 945393785
40 637430437
34 890099810
24 952303758
10 925604686
4 753214661
11 718708236
22 868289856
11 829766025
10 925608457
19 640362335
10 644476892
16 930...

output:

2661444590

result:

ok single line: '2661444590'

Test #44:

score: 33
Accepted
time: 5ms
memory: 5436kb

input:

40 496463
28 738084705
15 898550967
40 763074368
32 837986867
32 942216033
13 856836487
20 793001875
32 914058962
28 948460805
19 996421342
29 891979805
8 837113574
13 787002223
12 780641428
13 722451752
25 788970866
34 988435567
2 965013102
0 754168493
27 872232667
12 995001749
20 875486433
25 8033...

output:

45178133

result:

ok single line: '45178133'

Test #45:

score: 33
Accepted
time: 4ms
memory: 5376kb

input:

40 354788490
31 418636662
38 361966458
11 741919909
36 624686847
30 237930654
20 848553776
30 739580296
18 627923142
25 948765010
8 944204212
16 800271029
36 348066617
31 385966481
19 586438622
1 993551164
19 542191870
6 994378654
2 993440875
23 621889579
5 997776307
21 695891186
38 125106033
15 811...

output:

1178620474

result:

ok single line: '1178620474'

Test #46:

score: 33
Accepted
time: 0ms
memory: 5392kb

input:

40 11186912
21 819188396
10 863121127
8 812385287
28 919787402
31 529034016
40 940607967
4 946875031
23 691115613
12 829788973
9 958529656
8 910218011
36 438089052
35 424777334
40 63540247
21 789028269
14 660910075
0 882265146
1 997603098
16 630082472
32 504122218
9 935130843
36 638881853
38 8287389...

output:

901880583

result:

ok single line: '901880583'

Test #47:

score: 33
Accepted
time: 2ms
memory: 5400kb

input:

40 189215091
9 785347338
3 923017130
31 330735433
14 678414157
40 180812380
6 808086774
0 931879612
10 749407928
40 10099534
20 717211897
3 914780644
25 395309185
21 479040565
15 561967472
11 732351796
0 993236962
22 565931686
26 681136152
9 767799019
37 69639665
4 878680793
19 685731462
28 39284954...

output:

1877955067

result:

ok single line: '1877955067'

Test #48:

score: 33
Accepted
time: 2ms
memory: 5348kb

input:

40 23921
8 758795362
26 311762913
17 490489115
3 998193112
6 908359476
9 741782519
29 810388119
21 316551139
22 561360478
12 728408380
29 248844508
40 929576745
25 336561770
18 424465462
8 776686456
22 552902337
3 963791848
8 827724982
5 941082218
19 367014450
39 168240533
7 828050546
23 902420297
3...

output:

1507023

result:

ok single line: '1507023'

Test #49:

score: 33
Accepted
time: 4ms
memory: 5264kb

input:

40 223384422
6 817027789
19 478289788
4 893349646
24 178222165
29 123934589
7 807764344
26 169628132
32 184112455
10 805849019
6 874162373
38 72990476
40 3160499
12 953758576
1 963383453
39 44537575
5 820099306
34 684862959
22 239123115
20 474255973
35 74613631
16 586597076
27 131047742
30 113421885...

output:

895742306

result:

ok single line: '895742306'

Test #50:

score: 33
Accepted
time: 5ms
memory: 5312kb

input:

40 8613387
20 496577340
9 661428616
4 788254889
31 212735347
16 568485882
33 182323447
14 616915188
22 427473303
15 593254234
8 670777569
27 342252459
6 705881042
9 762460542
10 760606059
3 937950997
34 78436392
21 440406206
17 519339896
28 993102611
18 516103955
24 411202222
5 728670714
36 52101197...

output:

637390638

result:

ok single line: '637390638'

Test #51:

score: 33
Accepted
time: 6ms
memory: 5384kb

input:

40 982897772
10 676261773
0 955495507
22 450070334
30 340939334
32 300447466
11 647427687
17 531207490
1 912879078
40 15042514
25 379263192
9 718365595
3 887974792
5 857744808
36 130808013
6 824152563
27 361775332
12 621652042
2 900293338
31 313136750
8 734907256
4 862894460
21 450941120
37 88100188...

output:

0

result:

ok single line: '0'

Test #52:

score: 33
Accepted
time: 0ms
memory: 5308kb

input:

40 646014
1 911280203
2 900613585
37 100592262
4 831994976
39 46561929
7 768801576
29 316916668
0 951152970
30 315026417
34 199240769
12 624585259
20 534428063
14 613492285
23 496137014
18 546678096
13 621195264
38 86346027
24 437178045
3 879725425
22 518155152
35 179991908
17 565401094
32 306689917...

output:

0

result:

ok single line: '0'

Test #53:

score: 33
Accepted
time: 3ms
memory: 5340kb

input:

40 76500852
29 764334047
2 909920465
7 789003198
3 892756475
2 929932612
29 488502396
23 388479006
15 545763482
21 4328296
5 890573589
27 682963225
7 976834617
33 577793888
31 571993268
16 120951208
31 551033169
18 29490364
19 18417167
26 868197819
27 206
3 989368179
3 963631170
22 829390738
14 6384...

output:

1220895627

result:

ok single line: '1220895627'

Test #54:

score: 33
Accepted
time: 0ms
memory: 5400kb

input:

40 202955
15 956807142
24 6121302
28 3368
30 789577719
6 738372159
9 690512721
18 338132561
17 22613524
13 557177702
35 543526688
2 971373499
7 707237695
16 27484190
5 785849780
5 934668217
4 922921023
23 547416447
27 17045
40 598917299
33 502246724
11 618777229
34 202372625
37 304039930
23 6848598
...

output:

12819224

result:

ok single line: '12819224'

Test #55:

score: 33
Accepted
time: 1ms
memory: 5440kb

input:

40 157615
38 478992657
28 568653189
6 862231507
0 978758995
19 232177501
7 809672092
14 116157228
15 774050
37 214309509
33 175535848
21 11811
29 1
9 642489416
18 52669
25 511613359
32 31770657
27 583
29 400352594
25 613353666
8 690911287
40 451910608
24 7421
11 945054014
4 879849429
19 883845551
4 ...

output:

5107153

result:

ok single line: '5107153'

Test #56:

score: 33
Accepted
time: 4ms
memory: 5304kb

input:

40 218253
0 822728709
40 749188003
40 756303665
40 80288435
40 565742184
40 625034493
40 94968178
40 609164706
40 826226081
40 889559686
40 782092883
40 785981880
40 780774401
40 693860736
40 442153729
40 770441373
40 67746385
40 964497827
40 914713295
40 215624676
40 93901278
40 794865119
40 834833...

output:

150682525

result:

ok single line: '150682525'

Test #57:

score: 33
Accepted
time: 4ms
memory: 5396kb

input:

40 1000000000
40 880460960
40 701301591
40 118972220
0 1000000000
40 210641233
40 918598644
40 36678728
40 469366744
40 17713115
40 358446264
40 692824266
40 902470994
40 612812683
40 802023511
40 642907096
40 407524586
40 85390101
40 383427800
40 100909769
40 628081507
40 708288968
40 513348159
40 ...

output:

38000000000

result:

ok single line: '38000000000'

Test #58:

score: 33
Accepted
time: 0ms
memory: 5404kb

input:

40 903010436
3 186429052
3 866752174
3 438394119
3 465436648
3 856133870
3 131418921
3 46639173
3 193584395
3 368739657
3 766824538
3 302137043
3 179377030
3 26027844
3 63835158
3 374542542
3 254256067
3 227075725
3 119560589
3 56828488
3 218269937
3 469620862
3 522623910
3 893194687
3 906726006
3 4...

output:

36206465076

result:

ok single line: '36206465076'

Test #59:

score: 33
Accepted
time: 5ms
memory: 5384kb

input:

40 5
24 615571454
24 335194138
24 524152280
24 870549924
24 256269835
24 505451503
24 794555132
24 627639447
24 854459108
24 600772752
24 204618462
24 586213748
24 730253837
24 895096691
24 108800262
24 802392995
24 892254633
24 750987219
24 249701195
24 366844201
24 471890316
24 278282690
24 986241...

output:

3900

result:

ok single line: '3900'

Test #60:

score: 33
Accepted
time: 5ms
memory: 5380kb

input:

40 32
40 996797796
40 592358781
40 603851912
40 679989936
40 899949930
40 916795808
40 797670897
40 674069551
40 656215435
40 666817637
40 663956165
40 588439879
40 521795122
40 590395520
40 780868144
40 956998722
40 776530006
40 621569649
40 694190301
40 786991921
40 571657644
40 711117000
40 67737...

output:

24960

result:

ok single line: '24960'

Test #61:

score: 33
Accepted
time: 4ms
memory: 5340kb

input:

40 87823983
8 800623384
3 978315302
5 907771877
6 875197995
4 979257882
0 981730121
7 928229656
7 877723481
0 992406401
7 901758989
4 956513810
5 939739074
7 812911471
7 837275945
1 976411864
5 905584852
4 943240793
8 903423450
7 855489781
5 972922876
6 960114042
4 986715108
6 999502288
3 951322491
...

output:

5274686165

result:

ok single line: '5274686165'

Test #62:

score: 33
Accepted
time: 4ms
memory: 5340kb

input:

40 182
0 26208
0 24752
1 19656
0 22568
3 6552
0 23296
3 728
1 21840
2 8736
2 10192
2 9464
1 16016
2 11648
3 4368
0 26936
3 3640
2 13832
0 25480
2 14560
1 16744
3 5096
3 7280
2 10920
1 17472
1 15288
0 27664
3 1456
1 18928
1 20384
2 8008
0 24024
1 21112
3 2912
3 5824
1 18200
2 13104
0 29120
3 2184
2 1...

output:

30940

result:

ok single line: '30940'

Test #63:

score: 33
Accepted
time: 0ms
memory: 5396kb

input:

40 161
4 21896
4 25760
1 42504
0 48944
4 24472
5 19320
2 38640
0 47656
2 34776
1 41216
0 51520
7 5152
2 37352
6 10304
1 43792
5 14168
3 28336
7 3864
5 15456
2 33488
5 18032
3 29624
5 16744
7 1288
3 27048
1 39928
6 12880
1 45080
3 30912
7 6440
7 2576
4 23184
4 20608
6 7728
0 50232
6 9016
6 11592
2 36...

output:

39928

result:

ok single line: '39928'

Test #64:

score: 33
Accepted
time: 4ms
memory: 5340kb

input:

40 187
5 51612
1 78540
9 22440
8 26928
6 40392
3 60588
0 87516
11 4488
7 33660
6 38148
10 11220
4 56100
11 6732
9 17952
1 76296
4 58344
0 89760
7 35904
10 8976
5 49368
9 15708
2 74052
8 24684
4 53856
6 44880
8 29172
3 62832
1 80784
0 83028
3 65076
9 20196
7 31416
6 42636
2 71808
3 67320
5 47124
11 2...

output:

55726

result:

ok single line: '55726'

Test #65:

score: 33
Accepted
time: 4ms
memory: 5384kb

input:

40 100000
13 2806040
18 306699
8 7825610
10 5505511
20 1016
17 604060
10 5509977
12 3614670
9 6618564
16 1003260
8 7829146
15 1508442
4 13617068
19 102230
6 10536240
5 12038800
17 601864
1 19034660
13 2801936
5 12033616
7 9129988
7 9103976
19 103736
4 13608415
6 10523550
1 19033680
18 300711
20 1470...

output:

21000076

result:

ok single line: '21000076'

Test #66:

score: 33
Accepted
time: 0ms
memory: 5312kb

input:

40 100000
1 19031780
12 3615903
2 17134770
9 6602808
14 2115344
6 10533720
4 13615623
19 104776
12 3603456
3 15315570
7 9101652
11 4511570
17 604464
13 2806304
2 17144745
13 2812128
3 15319206
20 1656
8 7800728
16 1003520
16 1000505
5 12001040
19 103780
15 1503204
11 4520630
18 302757
10 5500462
8 7...

output:

21000924

result:

ok single line: '21000924'

Test #67:

score: 33
Accepted
time: 4ms
memory: 5260kb

input:

40 100000
12 3609909
16 1000585
14 2101841
10 5502420
1 19031020
18 307071
6 10533495
2 17136556
9 6609600
12 3603474
20 468
19 102456
19 100684
18 301797
1 19033060
11 4523200
2 17141914
13 2810608
8 7827274
15 1503870
14 2116884
5 12014672
8 7815600
7 9105810
3 15309090
4 13631127
16 1010150
3 153...

output:

21000700

result:

ok single line: '21000700'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%