QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#354497#1408. Straps0x3b80000155 1ms19212kbC++141.1kb2024-03-15 15:11:282024-03-15 15:11:29

Judging History

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

  • [2024-03-15 15:11:29]
  • 评测
  • 测评结果:55
  • 用时:1ms
  • 内存:19212kb
  • [2024-03-15 15:11:28]
  • 提交

answer

#include <iostream>
#include <algorithm>

int N;
int slot = 1, sum;
int a[2007], b[2007], n;
int s[2007], m;
int dp[2007][2007];

int main() {
  std::cin.tie(nullptr)->sync_with_stdio(false);
  std::cin >> N;
  while (N--) {
    int A, B;
    std::cin >> A >> B;
    if (A == 0) {
      if (B > 0) {
        s[++m] = B;
      }
    } else if (A == 1) {
      if (B > 0) {
        sum += B;
      }
    } else {
      if (B >= 0) {
        slot += A - 1, sum += B;
      } else {
        ++n, a[n] = A - 1, b[n] = -B;
      }
    }
  }
  for (int i = 1; i <= 2000; ++i) {
    dp[0][i] = +0x77359400;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= 2000; ++j) {
      dp[i][j] = dp[i - 1][j];
    }
    for (int j = a[i]; j <= 2000; ++j) {
      dp[i][j] = std::min(dp[i][j], dp[i - 1][j - a[i]] + b[i]);
    }
  }
  std::sort(s + 1, s + m + 1, std::greater<>());
  int ans = 0;
  for (int i = 0; i <= m; ++i) {
    sum += s[i];
    ans = std::max(ans, sum - dp[n][std::max(i - slot, 0)]);
  }
  std::cout << ans << '\n';
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 3620kb

input:

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

output:

216

result:

ok single line: '216'

Test #2:

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

input:

10
0 8717
0 -1439
0 6057
0 8938
1 -5032
0 2034
0 -93
0 3948
0 2876
2 6936

output:

24591

result:

ok single line: '24591'

Test #3:

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

input:

15
2 178300
0 222798
1 303257
0 -966638
0 984971
1 996028
2 -992390
2 120297
0 -530315
1 141482
0 117191
0 450466
2 493373
0 -249482
0 198977

output:

4089949

result:

ok single line: '4089949'

Test #4:

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

input:

15
0 553601
1 288078
0 331839
2 -222499
2 -883903
2 852155
0 -295174
2 -785059
0 -853481
2 325405
1 585408
1 110447
1 -69726
2 834108
1 -216789

output:

3881041

result:

ok single line: '3881041'

Test #5:

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

input:

15
0 619136
0 578740
1 135228
2 -357732
0 -924258
0 -775835
2 569135
0 802894
0 994564
0 116017
2 -209788
2 805032
0 -897130
0 -144105
2 560806

output:

5065535

result:

ok single line: '5065535'

Test #6:

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

input:

15
0 684671
1 156494
0 200765
2 386407
2 160591
0 419810
0 -215906
1 990382
0 519304
0 -353576
0 574979
0 916590
0 586966
1 796216
1 -924040

output:

4678317

result:

ok single line: '4678317'

Test #7:

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

input:

15
0 225918
0 -803713
0 366299
0 552732
2 -576472
0 -725804
0 733849
1 -982236
0 683067
1 -858223
0 -975326
1 -791903
0 -707546
0 751453
0 -356034

output:

908830

result:

ok single line: '908830'

Test #8:

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

input:

15
0 160391
0 707496
0 -476540
2 554136
0 -904145
0 -153878
0 -235049
0 486391
0 547697
2 994640
0 290738
0 608183
0 -824091
1 24647
1 -230180

output:

3436799

result:

ok single line: '3436799'

Test #9:

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

input:

15
3 -83847
0 -38331
0 -947276
0 -817971
0 899246
1 -186404
0 -565769
0 -47791
3 -187656
1 297649
1 -447684
0 -358340
0 34281
1 608872
0 995889

output:

2752090

result:

ok single line: '2752090'

Test #10:

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

input:

15
0 -232827
0 -674957
0 -19966
3 -33932
0 964782
0 -518046
3 -639319
2 313830
1 -796179
0 805654
0 -456714
3 708846
1 -755971
0 -833174
0 -954151

output:

2793112

result:

ok single line: '2793112'

Test #11:

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

input:

15
0 -167292
0 251442
0 808481
0 349166
0 -8930
0 -515844
0 -84488
3 264744
2 348086
0 866033
0 -170360
0 -632575
0 98742
3 768447
0 -597600

output:

3755141

result:

ok single line: '3755141'

Test #12:

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

input:

15
0 -101757
0 -57347
3 987184
0 -571198
0 833710
0 526452
1 -540247
0 163543
0 898381
0 331710
0 345837
1 -309
0 -723527
0 -106595
0 76602

output:

3245727

result:

ok single line: '3245727'

Test #13:

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

input:

15
3 -714738
0 43568
0 713803
0 -187187
0 -761577
0 -318865
1 116702
0 -459318
0 802594
1 906014
2 570846
2 -371179
0 -912962
3 -372854
2 -564397

output:

3109959

result:

ok single line: '3109959'

Test #14:

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

input:

15
0 -465570
0 -906740
0 -824357
2 799680
0 601646
0 -407651
0 -279969
0 862255
0 -891410
0 269864
1 652911
0 -287043
3 883672
0 -987850
0 -18819

output:

4070028

result:

ok single line: '4070028'

Test #15:

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

input:

15
0 435379
0 610377
0 189998
0 -523056
0 -44320
0 -42646
0 -371902
0 -7103
0 -704028
0 652451
0 956180
0 789878
0 -899125
0 -60687
0 -180657

output:

956180

result:

ok single line: '956180'

Test #16:

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

input:

15
0 287034
1 741004
0 512052
1 889777
0 257972
0 851115
2 141711
0 853909
0 444209
0 810269
0 642415
0 318479
0 708866
2 796114
0 964525

output:

5238155

result:

ok single line: '5238155'

Test #17:

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

input:

15
1 891496
0 806284
1 500294
0 289887
1 343821
0 941019
1 480895
1 572784
0 857613
0 997700
0 840273
0 616807
0 292654
0 405341
0 340700

output:

3786990

result:

ok single line: '3786990'

Test #18:

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

input:

15
0 795927
2 449029
0 311740
1 271918
0 198221
0 396124
0 19809
2 645944
0 477376
2 854610
0 997897
0 710060
2 372442
0 228746
0 748581

output:

6323784

result:

ok single line: '6323784'

Test #19:

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

input:

15
1 390521
0 514309
0 377277
0 908331
0 247963
0 438531
0 126117
0 239292
0 648424
2 83512
0 157571
0 930464
0 824569
0 737458
0 752107

output:

2312828

result:

ok single line: '2312828'

Test #20:

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

input:

15
0 946977
0 -878058
0 840569
0 -747953
0 -255700
0 -880137
0 586930
0 -121803
0 375339
0 89061
0 333054
0 493867
0 -781246
0 -223430
0 -788170

output:

946977

result:

ok single line: '946977'

Test #21:

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

input:

15
0 226092
0 -648053
0 547361
0 -43799
0 -42163
0 -936473
0 -145743
3 -737957
0 636003
0 44811
0 -268067
0 -394022
0 372160
0 -504225
0 473188

output:

918595

result:

ok single line: '918595'

Test #22:

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

input:

15
0 980918
0 -87266
0 332076
0 248883
0 -683526
0 -650270
0 -407688
0 -439767
0 -3025
0 980383
0 -104891
2 511686
0 620350
0 921026
0 924277

output:

2472987

result:

ok single line: '2472987'

Test #23:

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

input:

15
0 784321
5 794141
0 832549
0 938860
0 -22110
0 108654
9 -65223
0 -10616
0 29801
0 -264223
0 -626125
0 -776695
0 423277
0 38017
8 144026

output:

4093646

result:

ok single line: '4093646'

Test #24:

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

input:

15
5 925360
4 287109
8 -900606
10 922108
9 117695
13 -307986
5 265364
1 3226
3 -572646
10 612757
14 236957
13 599081
10 405679
7 -23037
10 -51415

output:

4375336

result:

ok single line: '4375336'

Test #25:

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

input:

15
8 -64868
5 738123
6 866430
10 569859
1 -22565
13 -642327
3 -170822
15 -502728
2 -410922
6 -930518
10 -708164
3 -362580
15 881145
3 -255932
6 578884

output:

3634441

result:

ok single line: '3634441'

Subtask #2:

score: 5
Accepted

Test #26:

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

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: 0
Accepted
time: 0ms
memory: 3588kb

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: 0
Accepted
time: 1ms
memory: 3576kb

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: 0
Accepted
time: 0ms
memory: 3644kb

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: 0
Accepted
time: 0ms
memory: 3644kb

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: 0
Accepted
time: 0ms
memory: 3676kb

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: 0
Accepted
time: 0ms
memory: 3588kb

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: 0
Accepted
time: 1ms
memory: 3596kb

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: 0
Accepted
time: 1ms
memory: 3636kb

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: 0
Accepted
time: 1ms
memory: 3740kb

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: 0
Accepted
time: 1ms
memory: 3684kb

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: 0
Accepted
time: 1ms
memory: 3704kb

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: 0
Accepted
time: 1ms
memory: 3596kb

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: 0
Accepted
time: 1ms
memory: 3660kb

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: 0
Accepted
time: 1ms
memory: 3648kb

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: 0
Accepted
time: 1ms
memory: 3600kb

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: 0
Accepted
time: 0ms
memory: 3656kb

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: 0
Accepted
time: 1ms
memory: 3708kb

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: 0
Accepted
time: 0ms
memory: 3708kb

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: 0
Accepted
time: 1ms
memory: 3640kb

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: 0
Accepted
time: 1ms
memory: 3672kb

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: 0
Accepted
time: 1ms
memory: 3684kb

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: 0
Accepted
time: 1ms
memory: 3692kb

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: 0
Accepted
time: 1ms
memory: 3656kb

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
Accepted
time: 1ms
memory: 3656kb

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:

1005695686

result:

ok single line: '1005695686'

Test #51:

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

input:

2000
0 573403
0 686578
0 245270
0 814249
0 478003
0 61449
0 363504
0 590517
0 685394
0 487925
0 580211
0 142830
0 938593
0 912871
0 599931
0 817877
0 117311
0 412182
0 794899
0 919780
0 690914
0 120537
0 311281
0 616453
0 573845
0 623318
0 914280
0 460699
0 889578
0 371084
0 740152
0 710247
0 915592...

output:

905189230

result:

ok single line: '905189230'

Test #52:

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

input:

2000
0 860033
0 490402
0 32260
0 579503
0 821923
0 234459
0 571280
0 392879
0 507758
0 68680
0 854799
0 544495
0 951736
0 599055
0 137311
0 633513
0 706613
0 233542
0 811038
0 391273
0 17153
0 483338
0 113487
0 994489
0 923746
0 171776
0 236436
0 397440
0 404979
0 257990
0 879524
0 963822
0 107953
0...

output:

1006062137

result:

ok single line: '1006062137'

Test #53:

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

input:

2000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 1000000
0 100...

output:

2000000000

result:

ok single line: '2000000000'

Test #54:

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

input:

2000
762 24833
85 169151
951 899749
206 394592
920 919879
220 827380
443 335228
283 886537
813 889271
963 188229
195 809080
406 69203
917 655840
876 795358
298 681938
25 451811
87 914276
766 160310
620 44762
428 652734
272 207421
527 895889
972 389448
570 644705
369 256049
200 753391
218 281255
297 ...

output:

990661576

result:

ok single line: '990661576'

Test #55:

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

input:

2000
98 10901
171 16906
10 26560
936 821
923 10415
1296 21584
1226 1149
232 27233
1262 27470
972 24665
391 1972
1543 1528
1781 24072
938 2985
855 19822
411 145
446 15101
1066 19908
1599 22022
294 23095
1272 25890
993 8557
199 3946
1930 24820
1260 3791
982 18398
1136 23951
290 22515
1067 5450
305 127...

output:

30043770

result:

ok single line: '30043770'

Test #56:

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

input:

2000
1726 287803
88 368225
497 13344
1081 853695
1078 404200
533 565328
456 432088
756 392757
881 324496
964 442827
1503 354470
1960 504903
662 712936
1660 997148
1656 921923
1905 279401
1952 659813
1222 43810
31 66961
700 637949
702 549424
1901 907594
1933 592020
1001 206709
699 847016
933 557864
1...

output:

1051415970

result:

ok single line: '1051415970'

Subtask #3:

score: 45
Accepted

Test #57:

score: 45
Accepted
time: 0ms
memory: 3736kb

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:

8669946

result:

ok single line: '8669946'

Test #58:

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

input:

100
0 -601878
2 405608
0 -153809
0 -584656
2 -24952
2 -284422
2 -914355
0 -659277
0 341551
0 -474238
2 866750
0 -3588
2 -548051
0 808314
0 -314683
0 -440055
0 706801
0 377441
2 905617
1 731777
0 500262
0 -882215
0 -494896
2 -685102
0 -55893
0 54619
1 259592
0 524352
1 827315
0 -734946
2 852722
0 -13...

output:

22909865

result:

ok single line: '22909865'

Test #59:

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

input:

100
0 -536343
0 170570
1 -350416
0 -311927
0 -839496
0 849976
0 -607656
0 935808
0 566963
0 -329857
0 223075
1 -399593
1 517960
0 792205
2 -251039
0 789683
1 -611030
1 -803302
0 230137
1 922683
1 -991249
1 -615215
0 -849741
1 459138
0 803215
1 -320900
0 -66563
0 606325
0 -500712
2 -658330
0 -89432
0...

output:

8915512

result:

ok single line: '8915512'

Test #60:

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

input:

100
0 -470808
0 910357
0 15162
1 -47390
2 -711662
0 -921194
0 166188
0 300024
0 310715
2 30965
0 268200
0 -546915
0 -54343
0 -932991
0 590797
0 822970
0 642483
0 708272
0 112913
0 655119
0 -336149
0 800411
0 -560562
0 810053
0 604884
2 -954037
0 293885
0 -558942
1 -533199
2 -134443
0 -604290
0 -9099...

output:

16185496

result:

ok single line: '16185496'

Test #61:

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

input:

100
2 227226
0 732520
2 -296214
0 613794
0 443562
0 263676
0 -611633
0 984891
0 133930
0 478061
0 -95845
0 -379160
0 -485581
0 518445
2 718760
0 622072
0 -216065
0 189578
0 582051
1 -552370
0 867507
0 994541
0 -771087
1 -436127
3 482489
0 -902780
0 627288
0 -665977
1 -770576
0 241525
0 -711267
0 399...

output:

16050463

result:

ok single line: '16050463'

Test #62:

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

input:

100
0 -864026
0 -667330
0 366403
0 -716850
0 305261
0 492901
2 -546531
0 236477
0 698652
0 227851
1 -524803
3 625513
0 953678
0 -499118
3 669379
0 -673728
0 -961090
0 -486921
2 -334274
0 388863
0 -104640
0 -260997
0 -43314
0 349907
0 -81122
0 381847
3 859624
0 53996
0 -989625
0 -497826
0 -107400
2 1...

output:

20955387

result:

ok single line: '20955387'

Test #63:

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

input:

100
2 358300
0 864104
3 702113
0 -866292
0 -243148
0 -709164
0 750670
0 -954124
0 -573638
0 -337653
3 438641
0 -762329
0 -749522
2 -917863
0 -340356
0 989764
0 -698077
0 292604
0 549946
0 437891
0 -325674
0 -357027
0 249545
0 933162
0 -150765
0 -324880
0 -194639
0 -773143
0 937841
0 820077
0 90487
0...

output:

15404784

result:

ok single line: '15404784'

Test #64:

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

input:

100
0 -732956
0 -50776
0 975275
0 281477
0 825174
0 -193809
0 -147136
2 907645
0 -835068
0 -936843
0 227353
0 -951820
0 -788216
0 320220
0 -15920
1 -135125
0 397540
0 649419
0 -503727
0 -107382
0 -935318
0 93647
0 -348097
4 790381
0 780468
0 -358480
0 973758
1 806759
0 655289
0 505779
0 752757
0 978...

output:

12892236

result:

ok single line: '12892236'

Test #65:

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

input:

1000
0 -522528
0 364025
1 529923
2 -672733
0 568947
1 692878
0 -485598
0 -367469
0 681872
0 -46593
0 -90251
0 66823
1 -219238
0 751809
0 -30437
1 339341
0 476397
0 -133781
0 363454
1 837079
0 777199
0 -894386
0 -919930
0 931412
0 726281
0 -717679
0 793787
0 -266149
0 966823
0 -680832
1 -552956
0 -89...

output:

157820672

result:

ok single line: '157820672'

Test #66:

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

input:

1000
0 -456993
0 59844
0 -871965
0 47379
2 609030
2 259531
2 -910024
0 -230385
2 446080
0 -806916
2 -507110
0 -378933
0 398408
0 484232
0 -82678
2 368226
1 -749500
1 586251
0 809427
0 702517
0 -251433
1 318758
2 -628922
0 45054
0 -776099
0 593017
0 -439835
0 302846
0 -411217
1 -84712
2 968899
2 7666...

output:

169747354

result:

ok single line: '169747354'

Test #67:

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

input:

1000
0 -391458
0 875234
0 -47618
0 -112955
2 412422
0 508519
0 46418
0 56765
1 -343271
0 -246557
0 697589
0 375798
0 33629
1 -985310
0 34405
0 -51969
2 23633
1 -185711
2 -906114
2 96138
0 904241
0 882115
2 9121
0 12119
0 -925248
1 -314131
2 -763632
0 -80811
2 -10047
2 -902212
2 -829812
2 339856
0 51...

output:

145516315

result:

ok single line: '145516315'

Test #68:

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

input:

1000
0 -325923
0 571053
0 -352054
0 951130
2 477958
0 -13712
0 -145612
0 -97329
0 551695
0 -242095
2 26260
0 -450934
0 546215
0 -847690
0 -667632
2 -833480
0 -13924
0 -73782
0 457906
0 436562
0 -866176
0 325915
0 -940849
0 236568
0 230530
0 446637
0 -891328
2 64719
0 -899227
0 421654
1 935020
0 8395...

output:

149791128

result:

ok single line: '149791128'

Test #69:

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

input:

1000
0 263900
0 -498748
0 -360080
0 705924
0 -164222
0 976277
3 -914361
0 -215951
1 806271
0 763630
0 375278
0 -822267
0 -698393
1 -120128
0 971375
0 226427
2 176862
0 -250835
0 -354977
3 -78783
0 638781
0 628672
0 -325278
0 -454180
0 -973501
0 620971
0 487509
0 -863572
0 -752715
0 628229
0 -71954
0...

output:

174802359

result:

ok single line: '174802359'

Test #70:

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

input:

1000
0 329435
0 -807025
0 -668612
0 -662551
0 575821
0 895050
0 852989
0 -630171
0 544666
0 544779
3 90762
3 -507256
2 669325
0 -884602
0 -324560
1 -721282
0 483998
0 -845310
0 -474074
0 676557
3 -956764
0 -673637
0 -150803
0 -310288
0 -778022
0 119734
0 426495
2 -345787
1 -612420
0 521988
0 609166
...

output:

152732130

result:

ok single line: '152732130'

Test #71:

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

input:

1000
0 394970
0 20653
0 151639
0 669104
0 452844
0 887839
0 -51796
0 139345
0 -587330
3 -146488
0 929194
0 905247
0 -642596
0 -776236
0 -195900
0 -397637
0 -919885
0 954897
3 -639461
0 447142
2 -502182
0 -921711
0 380408
0 -964395
0 470851
0 285340
0 -71384
0 37787
0 -713769
0 495187
0 -651942
1 121...

output:

129364099

result:

ok single line: '129364099'

Test #72:

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

input:

1000
0 460505
0 -287624
0 -156893
0 -699371
4 -735600
0 -300814
0 509244
4 -88926
0 -866553
1 737098
0 339040
0 -608517
0 -242344
0 186570
0 243193
0 195654
0 127151
0 367623
0 -255867
0 946057
0 556171
0 583064
0 -642444
1 -208276
0 -31608
0 149002
0 899938
0 -523458
0 -276499
0 -121176
0 -688880
0...

output:

135558630

result:

ok single line: '135558630'

Test #73:

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

input:

2000
2 -928880
1 -558384
0 760477
2 -767229
2 -79527
1 250888
0 953350
0 -340685
0 19393
0 639521
0 565370
2 624491
0 694529
2 968066
2 490976
0 -97452
2 -778569
0 809776
0 72236
2 -581792
0 375028
0 -752066
2 -616060
0 123303
0 730941
0 760126
0 -99903
0 264248
0 -127020
0 -290339
1 -740231
0 -5074...

output:

318238396

result:

ok single line: '318238396'

Test #74:

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

input:

2000
0 -156170
0 824590
0 -866916
0 -176504
2 -701693
0 -884222
0 -622879
0 -415357
0 448630
0 -311657
0 -303789
0 357925
2 -887641
1 -329298
0 577885
0 -27986
0 348336
0 550942
1 723061
0 -299127
0 68214
0 -781726
1 -388935
0 -66874
0 -228915
0 653431
0 679704
0 531680
0 280623
0 -203168
0 725372
0...

output:

318211584

result:

ok single line: '318211584'

Test #75:

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

input:

2000
2 -797810
0 325300
0 -290331
0 -133600
0 -898301
2 13941
0 -362215
0 457951
0 -199919
0 665752
0 876591
0 866027
0 -216532
0 742533
0 -857913
1 -901431
0 29494
0 550350
1 352845
2 559638
0 -502497
0 772306
1 991973
2 -492038
0 -722485
0 -81557
2 -111674
0 -833446
2 -739731
2 -473329
0 -422040
2...

output:

270428799

result:

ok single line: '270428799'

Test #76:

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

input:

2000
0 -25100
0 -654984
0 -355197
2 -398137
0 -832765
0 168436
0 730880
0 -941372
0 898525
0 -984420
2 25485
1 554057
2 -400335
0 -321619
0 935504
1 -283180
0 -641519
0 994840
0 3155
0 -142402
0 -905564
0 87592
0 -96776
2 795326
0 -995065
2 -659683
0 -912122
2 -265200
2 367446
0 755174
1 -309939
2 9...

output:

264970930

result:

ok single line: '264970930'

Test #77:

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

input:

2000
0 -483853
0 350168
0 223807
0 -538102
0 470063
0 960415
0 888839
0 -262530
0 -349889
0 -875450
1 -308067
3 515113
0 -497707
0 -779430
0 -445233
0 107283
0 -11642
0 -20687
0 538343
0 -525186
0 6118
0 -747007
0 580073
0 141400
0 -254264
0 606500
0 -997319
0 925167
0 967902
0 -60790
0 -724857
3 44...

output:

333179022

result:

ok single line: '333179022'

Test #78:

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

input:

2000
0 -418318
0 41379
2 168418
0 811488
3 -695207
0 -112859
0 -683790
0 208720
0 126022
0 -603924
0 294720
0 -877773
0 -63364
0 752370
0 -673909
0 -337153
0 -58715
0 384128
0 78145
0 967412
0 -268057
0 730269
0 -446097
0 -46428
1 -515581
3 -42517
0 -311555
0 -96803
0 339831
0 710473
0 18923
0 -3029...

output:

336805487

result:

ok single line: '336805487'

Test #79:

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

input:

2000
0 -352783
0 870593
1 -28191
0 546695
0 839554
0 -179361
0 -683756
0 -363670
0 -943554
0 59171
0 76153
0 320831
0 220353
0 -60897
0 -384789
0 174607
0 77039
0 543025
0 -622535
0 -833843
0 84081
2 -930625
0 999484
0 348526
0 -528577
0 -246757
0 -468414
2 -260313
0 416776
2 132440
0 -321975
0 3745...

output:

260187466

result:

ok single line: '260187466'

Test #80:

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

input:

2000
0 892390
0 -937511
0 782
0 728619
0 412567
3 622048
0 233470
0 770393
1 -29003
0 926749
0 -475508
0 612684
0 825328
0 247717
0 443009
0 -810219
0 -324092
0 -775301
0 619361
0 -46869
0 -786621
0 954802
0 -404313
2 97752
0 -746964
3 -355997
0 20582
0 661331
0 -30103
0 -848175
0 -738660
0 324627
0...

output:

256561542

result:

ok single line: '256561542'

Test #81:

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

input:

2000
0 -517794
0 -588338
0 906830
0 408807
0 714847
0 -492426
0 642999
0 -438066
0 444964
0 -758746
0 -352641
0 862484
0 -109287
0 -313967
0 -755139
0 871119
0 -960465
0 -6172
0 -670037
0 521328
0 960673
0 933426
0 474852
3 336237
3 514414
0 349444
0 -638953
0 915715
0 335889
0 10311
0 199573
0 3010...

output:

263646470

result:

ok single line: '263646470'

Test #82:

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

input:

2000
4 -635016
1 -149397
0 814158
0 -725125
0 -759422
0 84494
0 -208079
0 538489
0 798676
0 438428
0 -131437
0 -994341
0 -849333
0 -393112
0 862242
2 -520630
0 -89409
0 -684885
0 627513
0 -893956
0 -723492
0 -213509
0 758302
0 706095
0 -195004
0 -531622
0 -918685
0 692568
0 -216292
0 736629
0 319847...

output:

216405089

result:

ok single line: '216405089'

Test #83:

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

input:

2000
0 268618
0 489624
0 748459
0 -447761
0 -414653
0 160406
0 999189
0 -105908
0 -543825
0 -216656
0 330082
0 -96422
0 -300456
0 -402078
0 -635330
0 -240378
0 587904
0 -886973
0 -906758
0 854938
0 -610818
0 445827
0 955834
0 701257
0 -281850
0 996726
0 406368
0 -238017
0 976122
0 -841303
0 -510536
...

output:

191021897

result:

ok single line: '191021897'

Test #84:

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

input:

2000
0 -486208
0 669743
0 16723
0 -523263
0 915904
0 542467
0 962241
0 -325349
0 -407800
0 34605
0 713934
0 843329
0 77458
0 -986893
0 462624
0 601829
0 -349181
0 -383498
0 -364281
0 338653
0 262121
0 -381955
0 162708
0 277122
0 -69748
0 627862
7 246988
0 -947192
0 920838
0 819906
0 19981
0 -400482
...

output:

217406968

result:

ok single line: '217406968'

Test #85:

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

input:

2000
0 103607
12 535998
0 -95953
0 -704808
0 907384
0 -873724
0 991352
0 154905
0 -391165
0 516740
0 -614698
0 -514767
0 995730
0 -315509
0 116577
0 848920
0 737103
0 -220814
0 22338
0 -28279
0 -399170
14 29207
0 -914073
0 -991352
0 -714230
0 -155920
0 245399
0 811553
0 -690833
0 -272778
0 388271
0 ...

output:

337601884

result:

ok single line: '337601884'

Test #86:

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

input:

2000
0 431842
0 634040
0 287109
0 823191
0 -701797
0 922108
0 -705991
0 -83107
0 -307986
0 -844944
0 685581
0 3226
0 -270953
0 233206
0 612757
0 158227
0 -929564
0 599081
0 -443455
0 336075
0 -23037
0 -357296
0 -893242
0 532346
0 -99481
0 -279310
0 900947
0 -152014
0 972351
0 -923076
0 -110698
0 655...

output:

194384602

result:

ok single line: '194384602'

Test #87:

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

input:

2000
0 292441
0 -825063
0 -811351
0 343865
0 53019
0 -878815
0 -69455
0 329491
0 -267054
0 -561962
0 -982781
0 608052
0 117567
0 -597788
0 574947
0 141242
0 98023
0 472801
0 -389101
0 -75798
0 183590
0 733628
0 -382373
0 940820
0 426849
0 426225
0 301786
0 530642
0 -139596
0 -124995
0 52397
0 -70499...

output:

222293880

result:

ok single line: '222293880'

Test #88:

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

input:

2000
0 179808
0 27783
0 226228
0 -526894
0 554979
0 -668131
0 -183117
0 872974
0 -310277
0 326182
0 -714973
0 -214146
0 762581
0 629668
0 -27927
0 458282
0 721003
0 627682
0 -554784
0 239772
0 -863064
0 -121905
0 947563
0 -643477
0 730279
0 74845
0 -588008
0 -936725
0 15852
0 -439676
0 17089
0 46723...

output:

284931407

result:

ok single line: '284931407'

Test #89:

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

input:

2000
15 -81565
15 -802365
15 -493014
15 -836316
15 -106815
15 -256605
15 -306867
15 -826860
15 -106849
15 -888257
15 -834219
15 -375230
15 -835509
15 -789198
15 -7127
15 -892906
15 -359030
15 -691967
15 -475773
15 -480922
15 -532484
15 -611850
15 -300525
15 -232450
15 -495761
15 -828084
15 -47534
15...

output:

95190

result:

ok single line: '95190'

Subtask #4:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #90:

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

input:

2000
0 -352783
0 870593
37 -28191
0 546695
0 839554
0 -179361
0 -683756
0 -363670
0 -943554
0 59171
0 76153
0 320831
0 220353
0 -60897
0 -384789
0 174607
0 77039
0 543025
0 -622535
0 -833843
0 84081
0 82718
0 -856571
0 435139
0 702551
0 -388712
0 268975
0 -265927
0 -260313
0 416776
30 132440
0 -3219...

output:

467720819

result:

ok single line: '467720819'

Test #91:

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

input:

2000
0 -532372
0 930264
0 840505
0 859466
0 -70014
0 -32426
0 548384
0 -317006
0 -455905
0 845091
0 302549
0 513882
0 -349142
0 107524
0 359541
0 -286310
0 925958
0 35471
0 -609815
0 583007
0 704200
0 920733
0 300196
0 -278182
0 -666372
0 357185
0 685746
0 -198665
0 934778
0 -259534
0 303423
0 62009...

output:

497175027

result:

ok single line: '497175027'

Test #92:

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

input:

2000
0 721378
0 266001
0 -437992
0 402860
0 -713107
0 -357090
0 -341188
0 -758057
0 83167
0 -599601
0 343655
0 -337145
0 -643262
0 214750
0 -538915
0 -892895
0 -417276
0 635371
0 -819040
0 -119383
0 -967446
0 -937749
0 -820035
0 213993
0 41848
0 -959784
0 -628713
0 -148953
73 479762
0 572054
0 -3582...

output:

515734525

result:

ok single line: '515734525'

Test #93:

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

input:

2000
0 447577
0 -252995
0 -755415
0 -732448
0 -917398
0 -885207
0 -775895
0 -803791
0 -219018
0 120865
0 307042
0 288689
0 -447576
0 404365
0 -459700
0 -85983
0 260417
0 965241
0 -956897
0 396097
0 259786
0 435195
0 -743193
0 -65491
0 874013
0 -443191
0 -954103
0 768811
0 -292804
0 956157
0 -877397
...

output:

468901535

result:

ok single line: '468901535'

Test #94:

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

input:

2000
0 -298672
0 -116914
0 -640627
0 -962937
0 987555
0 123216
85 396745
0 -12410
0 -644581
0 -571277
0 174012
0 49885
0 424474
0 -175677
0 39355
0 -185203
0 -22334
0 -867784
0 398444
0 -642144
0 426015
0 899523
0 -439168
0 514195
0 -963855
0 997967
0 -856441
0 404081
0 -518372
0 -82028
0 855338
0 9...

output:

479338138

result:

ok single line: '479338138'

Test #95:

score: -45
Wrong Answer
time: 1ms
memory: 3788kb

input:

2000
0 -478261
0 -597403
0 -538848
0 328805
0 -168564
0 -520728
0 225163
0 -156804
0 654295
0 -516087
0 -845746
0 667337
0 765448
0 782629
0 499356
0 889734
0 134627
0 227782
0 -883579
0 -367338
0 -312162
0 75682
0 -856804
0 -222756
0 -229237
0 402014
0 593079
0 170459
0 -415461
0 -806050
0 -590879
...

output:

483053442

result:

wrong answer 1st lines differ - expected: '483495368', found: '483053442'