QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#546929#1408. StrapsUZING0 9ms35260kbC++14670b2024-09-04 16:00:342024-09-04 16:00:34

Judging History

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

  • [2024-09-04 16:00:34]
  • 评测
  • 测评结果:0
  • 用时:9ms
  • 内存:35260kb
  • [2024-09-04 16:00:34]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=2010;
int n,ans,id;
int dp[N],f[N][N];
signed main()
{
	cin>>n;
	memset(f,128,sizeof(f));
	f[0][0]=0;
	for(int i=1;i<=n;i++)
	{
		int x,y;
		cin>>x>>y;
		if(x==0)
		{
			for(int j=n;j>=1;j--)
				dp[j]=max(dp[j],dp[j-1]+y);
		}
		else
		{
			x--;
			if(x==0)
			{
				ans+=max(y,0ll);
				continue;
			}
			id++;
			for(int j=x;j<=n;j++)
				f[id][j]=f[id-1][j]+y;
			for(int j=x;j<=n;j++)
				f[id][j]=max(f[id][j],f[id-1][j-x]+y);
		}
	}
	dp[n+1]=dp[n];
	int ma=0;
	for(int i=0;i<=n;i++)
		ma=max(ma,f[id][i]+dp[i+1]);
	cout<<ma+ans;
	return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 35092kb

input:

10
2 -57
0 0
2 -46
0 97
0 71
1 -18
0 49
1 94
1 -74
0 -80

output:

208

result:

wrong answer 1st lines differ - expected: '216', found: '208'

Subtask #2:

score: 0
Wrong Answer

Test #26:

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

input:

15
0 433301
0 609536
1 289214
0 148130
2 956794
2 950743
2 294089
0 650415
2 802613
0 225435
1 939087
0 817214
0 327478
0 469118
0 696523

output:

7475346

result:

ok single line: '7475346'

Test #27:

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

input:

100
1 795455
2 906249
1 669715
0 42085
0 584441
0 903137
0 596908
0 501072
1 940306
0 836598
2 700466
2 766834
2 517114
0 103457
0 202082
0 442358
0 505799
1 2634
0 622796
2 665422
0 124324
2 903818
0 168820
0 435314
0 687638
0 847227
2 183455
0 875879
0 682609
0 633869
0 517444
1 618206
0 457427
0 ...

output:

34193793

result:

ok single line: '34193793'

Test #28:

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

input:

100
0 389043
0 880626
1 225564
0 785523
0 845477
0 733799
0 743135
0 102204
0 907391
1 51490
1 655880
0 98362
0 553625
2 429093
0 634949
0 218551
0 853805
0 654200
1 219607
2 517691
0 956822
1 566390
0 620904
0 893606
0 460052
1 222435
1 262230
0 571077
0 920631
0 526687
0 403895
0 865106
0 330789
0...

output:

33904495

result:

ok single line: '33904495'

Test #29:

score: 5
Accepted
time: 6ms
memory: 35180kb

input:

100
0 454578
0 576378
1 291101
0 517427
0 911013
0 211566
0 550422
0 542711
0 790653
0 428700
0 240109
0 894169
2 212158
0 568531
0 326642
0 210330
0 118357
0 398071
0 931497
3 789154
0 583686
3 992928
0 218982
0 296907
0 387723
0 49186
0 257252
3 537072
0 119892
0 674135
0 786557
0 919272
0 55041
0...

output:

28836586

result:

ok single line: '28836586'

Test #30:

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

input:

100
0 520113
0 392994
0 170660
0 966892
0 716323
0 197500
0 907727
3 265706
0 915515
2 237764
0 425510
0 967953
0 882049
0 30179
0 460907
2 4863
0 378127
1 380571
0 122080
0 60914
0 810648
0 968321
0 836515
0 837361
0 577434
2 653016
0 657762
3 867200
0 378901
0 20190
0 178646
2 413076
0 635368
0 69...

output:

28435495

result:

ok single line: '28435495'

Test #31:

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

input:

100
0 585648
0 88746
0 866157
0 899436
0 460395
2 264252
0 165252
2 325803
0 940685
0 191383
0 278582
2 376730
0 984891
0 131540
0 676579
0 763596
0 468491
0 501277
0 811702
0 365920
0 190139
0 223013
0 581391
0 455143
0 31719
0 301251
0 324984
0 663571
0 657478
0 334288
0 18008
3 628959
0 623695
0 ...

output:

14854268

result:

ok single line: '14854268'

Test #32:

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

input:

100
0 175471
0 194962
0 678674
0 747820
0 792403
2 892796
0 399015
0 361122
0 146502
0 607639
0 55195
0 987514
0 620851
0 49152
1 470940
0 174739
0 632266
0 152051
0 185177
0 831733
0 767539
0 709740
0 770515
0 69655
4 659188
0 301099
0 681471
3 260853
0 466875
0 352273
0 606591
0 900416
0 975970
0 ...

output:

26625993

result:

ok single line: '26625993'

Test #33:

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

input:

1000
0 177836
0 784522
0 490441
0 917482
0 19019
0 290704
0 304854
0 242598
1 357601
1 20104
0 573143
0 873240
0 674878
0 146289
0 275609
0 654012
0 188495
0 247259
2 568192
1 25121
0 308881
0 118650
0 125004
2 261500
2 380871
1 457764
2 535089
0 616674
0 148596
1 48358
2 268609
1 591591
0 111913
2 ...

output:

310810523

result:

ok single line: '310810523'

Test #34:

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

input:

1000
0 719083
1 466702
0 284127
0 51885
1 944814
0 988271
2 278358
0 943694
1 343416
2 182843
1 241833
0 264263
0 550679
1 329864
0 559290
0 511465
0 512935
0 210225
0 560755
0 104988
0 475391
0 784786
0 901677
0 662781
0 883522
0 710111
2 684124
0 826652
0 621287
0 325827
0 6705
0 387780
0 411271
0...

output:

284797916

result:

ok single line: '284797916'

Test #35:

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

input:

1000
0 784618
0 287738
2 349662
0 783661
2 867687
0 986087
0 898147
0 592151
0 705072
0 74219
0 488567
2 57402
0 814172
0 584532
0 57373
0 342907
0 358590
1 143431
0 101968
0 357740
0 80475
0 589643
0 638566
0 429984
0 486866
2 811938
0 939502
2 499864
1 329666
1 322250
0 154610
0 812287
0 423609
2 ...

output:

278884229

result:

ok single line: '278884229'

Test #36:

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

input:

1000
0 850153
0 115618
0 758948
0 141354
0 61027
0 854076
0 80831
0 797285
0 145929
0 517742
0 934302
0 531719
0 771576
0 254812
2 470011
0 407466
0 356943
0 28114
0 718652
0 446373
2 649241
3 322271
0 887008
1 702490
0 299075
2 241358
0 620737
0 383047
0 130208
3 932721
1 830737
0 616980
0 459101
0...

output:

244690730

result:

ok single line: '244690730'

Test #37:

score: 5
Accepted
time: 4ms
memory: 35116kb

input:

2000
0 877008
0 276394
0 669709
0 177519
0 656747
1 475812
0 677043
2 805616
0 49046
0 32809
0 12718
0 825985
2 282627
2 922706
1 836944
2 905809
0 370230
1 596446
0 140458
0 160571
0 15255
0 855929
0 262546
0 524374
2 21142
1 721645
0 702281
0 536908
2 140348
1 107023
0 104046
0 912050
0 198536
0 2...

output:

568422711

result:

ok single line: '568422711'

Test #38:

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

input:

2000
2 545675
0 650394
0 536367
0 62440
1 830126
0 886051
1 702062
1 452599
0 234934
0 678535
1 886067
1 571414
1 461991
0 10371
0 306783
0 767823
0 200647
0 87619
0 399886
0 473503
0 799458
0 505068
2 835037
0 739430
0 404714
0 394027
1 557105
0 668704
0 929000
0 836202
0 478453
2 487280
2 390901
0...

output:

576776733

result:

ok single line: '576776733'

Test #39:

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

input:

2000
0 532366
0 91674
0 173819
2 798312
0 600306
0 590317
3 219170
0 120795
0 787517
0 667941
0 652759
0 712928
3 882430
0 11400
0 980501
1 940424
0 866418
0 690100
0 658985
0 954113
0 499210
0 588975
0 732069
0 909437
3 919645
0 240870
0 306480
0 382314
0 749043
0 194930
0 160418
0 435933
0 582595
...

output:

524383990

result:

ok single line: '524383990'

Test #40:

score: 5
Accepted
time: 4ms
memory: 35180kb

input:

2000
0 597901
0 920066
0 994272
0 444271
0 605955
0 739644
0 978611
0 791908
0 420933
0 830307
0 838544
0 581607
0 763096
1 70108
2 257148
0 507439
0 176678
0 418453
1 469765
0 316737
3 199124
0 864142
0 658464
0 354119
0 405752
0 71630
0 920489
0 196056
0 915012
0 755164
0 710364
0 643782
0 726808
...

output:

414846273

result:

ok single line: '414846273'

Test #41:

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

input:

2000
0 663436
0 611210
0 685673
0 376687
0 345931
0 79797
0 976443
0 840806
0 24079
0 265385
4 592943
0 854123
0 16787
0 474778
0 379322
0 957072
4 652548
0 724495
4 985873
0 949428
0 849132
0 921244
0 983750
0 15037
0 7694
0 263579
0 120298
0 867950
0 942300
0 702007
0 450301
0 464005
0 509700
0 70...

output:

364443840

result:

ok single line: '364443840'

Test #42:

score: 5
Accepted
time: 6ms
memory: 35180kb

input:

2000
0 204683
0 441714
0 442262
0 213871
0 770739
0 360779
0 659778
0 626657
0 399216
0 411094
0 966451
0 30151
0 342848
0 608050
0 14160
0 343269
0 524124
0 117088
0 384777
0 216568
0 92520
0 819129
0 573278
0 397247
0 89162
0 244594
0 494073
1 400516
0 91157
0 503224
0 903517
0 539559
0 988629
0 7...

output:

368998056

result:

ok single line: '368998056'

Test #43:

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

input:

2000
0 270218
0 132858
0 133663
0 146799
0 510715
0 705026
0 657610
4 363432
0 969773
4 689632
0 392983
0 213640
0 142648
0 867911
0 480242
0 662211
3 147186
0 264270
0 165090
0 837724
2 418211
0 309321
0 795640
0 245109
2 359136
0 805540
0 677732
2 800169
0 792546
0 785679
0 520295
0 329812
0 80130...

output:

330426515

result:

ok single line: '330426515'

Test #44:

score: 5
Accepted
time: 4ms
memory: 35136kb

input:

2000
0 335753
0 961250
0 954116
0 176111
0 387939
0 270297
0 752338
0 994341
0 890660
0 195586
0 963285
0 379303
0 84464
0 758663
0 410295
0 457003
0 854147
0 672364
0 101940
0 44251
0 753006
0 694913
0 231677
0 620520
0 212925
0 886799
0 426908
0 472112
0 772796
0 285766
0 331771
0 116184
0 438075
...

output:

779925426

result:

ok single line: '779925426'

Test #45:

score: 5
Accepted
time: 4ms
memory: 35200kb

input:

2000
0 401288
0 652394
0 645517
0 109039
0 127915
0 614544
0 750170
0 526887
0 449326
0 320328
0 660294
0 733943
0 80120
0 25805
0 159136
0 477308
0 578268
0 875982
0 580846
0 384074
0 283453
0 200780
0 143552
0 582238
0 503439
0 38344
0 773992
0 14428
0 711173
0 896414
0 481471
0 71994
0 496537
0 3...

output:

850490893

result:

ok single line: '850490893'

Test #46:

score: 5
Accepted
time: 9ms
memory: 35200kb

input:

2000
0 991111
0 929682
0 560562
0 886447
0 422739
0 802476
0 704993
0 495146
0 856347
0 552125
0 968876
0 774223
0 683296
0 865874
0 298814
0 108080
0 815238
0 65280
0 818498
0 912023
0 723605
0 702023
0 914117
0 884744
0 198664
0 451317
70 72898
0 744919
0 814835
0 883810
0 671054
0 999942
0 762925...

output:

996337317

result:

ok single line: '996337317'

Test #47:

score: 5
Accepted
time: 4ms
memory: 35184kb

input:

2000
0 56646
0 624922
0 256059
0 258031
0 166811
0 108965
0 223145
0 444392
0 565649
0 713719
0 139647
0 423711
0 288488
0 431704
0 269865
0 347943
0 897049
0 78050
0 324440
0 80646
0 715974
0 56842
0 70520
0 99582
0 15162
0 355506
0 86305
0 423098
0 410332
0 319539
0 674057
0 239184
0 118882
0 2445...

output:

432410585

result:

ok single line: '432410585'

Test #48:

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

input:

2000
0 122181
0 449218
0 72416
164 972320
0 927995
0 475644
0 50249
0 908137
0 95826
0 880069
0 129711
0 600942
0 309651
0 637618
0 32024
0 21195
0 478301
0 332258
0 878318
0 548931
0 516079
0 325549
0 577343
0 527539
0 271749
0 37782
0 592772
0 797019
0 742701
0 704532
0 233802
0 237001
0 410378
0 ...

output:

976666351

result:

ok single line: '976666351'

Test #49:

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

input:

2000
0 187716
0 144458
0 767913
0 219247
0 784011
0 10295
0 315705
0 360876
0 363589
0 617443
0 241625
0 541375
0 332312
0 725357
0 444046
0 84841
0 418438
0 629358
0 949989
0 142949
0 85952
0 308338
0 19547
0 653481
0 285901
0 906511
0 599300
0 89362
0 462495
0 380096
0 138399
0 612040
0 443188
0 5...

output:

486295248

result:

ok single line: '486295248'

Test #50:

score: 0
Wrong Answer
time: 6ms
memory: 35104kb

input:

2000
0 728963
0 970866
0 520406
0 618287
0 204723
0 333129
0 478720
0 254635
0 105274
0 710556
0 119849
0 972559
0 315208
0 457722
0 370424
0 334759
0 136682
0 310410
0 834915
0 921610
0 469511
0 344114
0 58540
0 186606
0 580693
0 918973
0 770673
0 774440
0 394544
0 927541
0 995762
0 974134
0 589415...

output:

980802506

result:

wrong answer 1st lines differ - expected: '1005695686', found: '980802506'

Subtask #3:

score: 0
Wrong Answer

Test #57:

score: 0
Wrong Answer
time: 0ms
memory: 35180kb

input:

100
0 -667413
0 -445984
0 666245
0 -234139
2 -708424
0 -194486
1 590252
0 970705
0 780851
0 -99106
0 343332
0 -141987
2 -891544
0 758277
0 56736
2 130751
0 -281918
0 -180260
0 -753556
0 109598
0 10527
0 838070
0 -680417
2 -909922
0 773203
0 947861
0 -788839
0 -872770
1 -559025
2 -850041
2 -782399
0 ...

output:

8254532

result:

wrong answer 1st lines differ - expected: '8669946', found: '8254532'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%