QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#784910#7739. KnapsackadivseAC ✓42ms394800kbC++203.5kb2024-11-26 16:18:232024-11-26 16:18:27

Judging History

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

  • [2024-11-26 16:18:27]
  • 评测
  • 测评结果:AC
  • 用时:42ms
  • 内存:394800kb
  • [2024-11-26 16:18:23]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <iomanip>
#define endl '\n'
#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define rep2(i,a,b) for(int i=(a);i>=(b);i--)
using namespace std;
template<typename T>
void cc(const vector<T>& tem) { for (const auto& x : tem) cout << x << ' '; cout << endl; }
template<typename T>
void cc(const T& a) { cout << a << endl; }
template<typename T1, typename T2>
void cc(const T1& a, const T2& b) { cout << a << ' ' << b << endl; }
template<typename T1, typename T2, typename T3>
void cc(const T1& a, const T2& b, const T3& c) { cout << a << ' ' << b << ' ' << c << endl; }
void cc(const string& s) { cout << s << endl; }
void fileRead() {
#ifdef LOCALL
    freopen("D:\\AADVISE\\cppvscode\\CODE\\in.txt", "r", stdin);
    freopen("D:\\AADVISE\\cppvscode\\CODE\\out.txt", "w", stdout);
#endif
}
void kuaidu() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); }
inline int max(int a, int b) { if (a < b) return b; return a; }
inline double max(double a, double b) { if (a < b) return b; return a; }
inline int min(int a, int b) { if (a < b) return a; return b; }
inline double min(double a, double b) { if (a < b) return a; return b; }
void cmax(int& a, const int& b) { if (b > a) a = b; }
void cmin(int& a, const int& b) { if (b < a) a = b; }
void cmin(double& a, const double& b) { if (b < a) a = b; }
void cmax(double& a, const double& b) { if (b > a) a = b; }
using PII = pair<int, int>;
using i128 = __int128;
using vec_int = std::vector<int>;
using vec_char = std::vector<char>;
using vec_double = std::vector<double>;
using vec_int2 = std::vector<std::vector<int>>;
using que_int = std::queue<int>;


//--------------------------------------------------------------------------------
const int N = 5e3 + 10;
const int M = 1e4 + 10;
const int mod = 1e9 + 7;
const int INF = 1e16;
int n, m, T;
int suf[N][M];
//--------------------------------------------------------------------------------
//struct or namespace:
struct node {
    int ti;
    int val;

    bool operator<(const node& q1) const {
        return q1.val < val;
    }

};
node A[N];
priority_queue<int, vector<int>, greater<int>> F;

//--------------------------------------------------------------------------------

signed main() {
    fileRead();
    kuaidu();
    T = 1;
    //cin >> T;
    while (T--) {
        int k;
        cin >> n >> m >> k;
        rep(i, 1, n) {
            // cin >> ti[i] >> val[i];
            cin >> A[i].ti >> A[i].val;
        }
        sort(A + 1, A + n + 1, [&](const node& q1, const node& q2) {
            return q1.ti > q2.ti;
            });
        // rep(i, 1, n) {
        //     cc(A[i].ti, A[i].val);
        // }
        rep2(i, n, 1) {
            rep(j, 0, m) {
                if (A[i].ti <= j) suf[i][j] = max(suf[i + 1][j], suf[i + 1][j - A[i].ti] + A[i].val);
                else suf[i][j] = suf[i + 1][j];
            }
        }
        int sum = 0, ans = 0;
        int res = suf[1][m];
        rep(i, 1, n) {
            ans += A[i].val;
            F.push(A[i].val);
            while (F.size() > k) {
                auto val = F.top();
                ans -= val;
                F.pop();
            }
            cmax(res, ans + suf[i + 1][m]);
        }
        cc(res);
    }
    return 0;
}
/*


*/

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3640kb

input:

4 10 1
9 10
10 1
3 5
5 20

output:

35

result:

ok 1 number(s): "35"

Test #2:

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

input:

5 13 2
5 16
5 28
7 44
8 15
8 41

output:

129

result:

ok 1 number(s): "129"

Test #3:

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

input:

10 50 1
44 182173741
38 163268500
36 114173760
30 521894533
25 89514235
12 516184197
42 971377551
35 28242326
31 480227821
31 388523197

output:

2009456281

result:

ok 1 number(s): "2009456281"

Test #4:

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

input:

10 100 3
23 51015869
9 981426050
76 243762017
64 128189636
4 718411601
48 250140255
17 340478117
68 262055220
40 370503079
4 547232664

output:

3765024872

result:

ok 1 number(s): "3765024872"

Test #5:

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

input:

10 500 10
430 981427684
100 458631577
32 453298334
393 716958962
82 120486064
393 561149128
182 518807793
293 950335710
332 159193263
331 280711850

output:

5201000365

result:

ok 1 number(s): "5201000365"

Test #6:

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

input:

10 3000 10
1325 563890842
2007 190665722
1393 874490922
548 279594682
1380 155046921
2666 894516819
770 740325614
2735 643777488
2451 754155860
1068 138544189

output:

5235009059

result:

ok 1 number(s): "5235009059"

Test #7:

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

input:

10 10000 5
108 735534045
6250 87364128
3071 66920092
9343 555321302
9070 759896065
9843 146885261
3083 364637443
7088 370871572
7802 754417134
3125 697204945

output:

4451687859

result:

ok 1 number(s): "4451687859"

Test #8:

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

input:

100 50 61
24 517916473
33 497071404
40 343150837
13 559776223
2 941245278
27 987936903
7 403293890
26 68412861
28 683505315
6 173482637
31 220799032
29 815472376
42 426462445
25 470177395
43 818534622
26 137556071
15 308105056
27 745044655
28 309413241
11 61130780
36 963194467
19 701095156
5 9347020...

output:

44747553879

result:

ok 1 number(s): "44747553879"

Test #9:

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

input:

100 100 42
6 774586597
36 576227741
25 257737545
64 559313526
24 371408966
47 803303316
73 342479452
100 619687258
73 682542576
71 182579788
61 354270154
74 30869398
23 995859349
88 255983493
48 334287458
17 13677067
8 441554725
24 934072639
85 610681655
67 327543259
60 697383634
99 320640445
50 974...

output:

37584168931

result:

ok 1 number(s): "37584168931"

Test #10:

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

input:

100 500 69
117 850222604
135 908209075
281 762241158
193 853115556
202 773483428
88 819344894
37 520809128
225 453191940
252 471232760
298 621091678
378 269475999
19 530190234
459 143203529
477 500583846
446 989780043
50 655756632
321 345085464
423 47668454
132 218063309
325 62856046
474 485855270
1...

output:

42850231504

result:

ok 1 number(s): "42850231504"

Test #11:

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

input:

100 3000 11
2229 113662521
1085 957207016
2571 864419576
2103 102031619
1086 208274995
2005 887504188
2305 803801229
2933 316528833
188 551740507
2720 393827507
2514 955559466
1772 749230500
2676 744768311
2499 772159519
1989 848103925
322 484923680
1757 619590795
571 247505048
1094 438346067
339 99...

output:

17333176908

result:

ok 1 number(s): "17333176908"

Test #12:

score: 0
Accepted
time: 3ms
memory: 11444kb

input:

100 10000 79
7606 40784641
9074 752695754
1153 594817340
9411 584292898
2132 533306184
2666 184228160
2417 356339298
9689 241354004
4927 287380554
7178 158913616
1095 172127175
1688 175994092
4105 75848992
1380 273029283
8421 35148963
432 256969077
5939 82792225
647 500031012
2795 65555568
3395 7706...

output:

44371890318

result:

ok 1 number(s): "44371890318"

Test #13:

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

input:

500 50 126
3 136023068
13 869807356
14 472367566
28 50725598
25 45069923
5 147985467
37 720797915
17 90311040
19 873648042
38 796138954
3 966881081
40 132652908
31 585596518
39 352737389
29 876373760
41 512453383
19 805025356
14 710658601
18 403371907
36 854558198
32 179695697
45 775294020
9 1462316...

output:

124994976191

result:

ok 1 number(s): "124994976191"

Test #14:

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

input:

500 100 98
69 129626760
5 449978106
61 989261186
72 638069575
26 280608378
52 685908155
81 932855739
82 82350114
21 792779442
77 493204907
56 830543473
59 105028460
89 731643951
16 264908763
29 925524933
44 662702166
98 466470962
79 202167196
63 116753433
24 790841938
83 993709118
27 951733632
53 41...

output:

103191714648

result:

ok 1 number(s): "103191714648"

Test #15:

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

input:

500 500 100
380 60038575
204 222150928
205 758606015
5 931871605
405 977650137
493 996917028
41 111185415
303 915854795
412 581469626
95 931716797
480 745749318
16 749573487
217 878988131
193 364284925
27 435793326
481 9814435
314 959936294
375 315763011
305 724135087
290 231187429
197 487213458
357...

output:

107219972338

result:

ok 1 number(s): "107219972338"

Test #16:

score: 0
Accepted
time: 7ms
memory: 41304kb

input:

500 3000 155
885 618166135
1814 400752150
649 826302551
2748 853231980
1650 386604671
30 721008870
2484 887458709
1852 755040724
2313 171979057
1769 893148343
342 397870943
549 848606662
1374 960069408
932 119271788
2006 46601960
2622 893486791
2703 521939745
2133 687850539
1808 931850407
1569 10566...

output:

150198202618

result:

ok 1 number(s): "150198202618"

Test #17:

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

input:

500 10000 39
2164 103861995
3931 307468016
3010 393436072
3416 653030414
6970 794867887
1656 84454065
2169 732024599
6555 453581890
7342 410350010
3201 783977518
4349 922318777
6290 401288294
5183 135437558
8855 659116512
3520 255820440
1262 608543507
496 19150219
2425 358615167
6883 685038845
8879 ...

output:

54344848517

result:

ok 1 number(s): "54344848517"

Test #18:

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

input:

1000 50 796
15 386711393
14 946648902
38 652093661
13 136124305
14 299275346
23 686324157
20 405295225
12 571269091
49 850320620
23 513862466
13 625703085
4 730549435
17 302756512
38 93155670
19 285511180
15 887672509
39 377740062
13 507552700
23 511922533
41 365183175
15 207169111
16 195211892
18 2...

output:

467973714946

result:

ok 1 number(s): "467973714946"

Test #19:

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

input:

1000 100 416
18 324358277
17 197544843
11 247666199
6 821941951
33 274893936
90 501323389
7 405955067
6 587405899
13 39935735
22 292638914
15 836533241
89 878937103
55 551121000
24 815495796
60 539203840
19 916500680
83 626606672
36 777244403
65 816148796
93 601676404
27 114182523
38 509405915
4 545...

output:

350454528075

result:

ok 1 number(s): "350454528075"

Test #20:

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

input:

1000 500 862
429 694961580
8 969717665
267 457202516
235 820776685
408 826711502
27 252523751
72 584284743
27 420910581
192 418560512
449 731150804
440 751739086
438 673225235
382 843689373
109 60096150
257 194696425
352 263612948
295 120072003
435 745616026
312 718497746
51 336989191
444 902654159
...

output:

492713511906

result:

ok 1 number(s): "492713511906"

Test #21:

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

input:

1000 3000 351
727 8847709
2613 622538643
1461 97349529
1467 131003214
1043 126909307
532 219814384
2830 650278892
534 187011265
1312 789736632
1773 150503473
2766 702593294
1351 942888530
1656 764929540
2760 688345433
2131 310426897
1623 689276961
2098 193762961
2863 772562087
489 210523205
1687 791...

output:

317718205329

result:

ok 1 number(s): "317718205329"

Test #22:

score: 0
Accepted
time: 11ms
memory: 81888kb

input:

1000 10000 778
8901 374587545
7728 686705536
8090 632699030
8973 846089348
3693 855315786
8280 466401395
3762 691477129
7041 299407306
1348 72339995
266 48085564
6096 845178428
3340 512295215
9113 834760223
7761 585397824
4738 188388966
6971 458993083
3511 658239404
7788 959071523
5940 499882747
958...

output:

473643556169

result:

ok 1 number(s): "473643556169"

Test #23:

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

input:

3000 50 270
45 491619379
46 456136181
6 150276090
15 307922938
22 476230253
31 627626576
18 552999720
4 450084166
26 273018445
24 169175025
16 656547585
5 340241062
46 390744556
48 670230402
6 786162621
28 709925602
32 537681828
46 789083627
10 264958422
20 154381571
24 560364557
30 790662742
17 502...

output:

290860604546

result:

ok 1 number(s): "290860604546"

Test #24:

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

input:

3000 100 1090
95 929126436
78 344445858
98 596187078
81 402574836
60 159026070
98 213043026
1 447783807
58 731790292
68 365118050
47 337266628
37 702913172
29 76108832
3 526350941
1 914180379
68 211064953
69 603459740
8 77781147
69 849933501
74 430480358
60 232768589
11 51843442
56 346787151
100 879...

output:

924830589780

result:

ok 1 number(s): "924830589780"

Test #25:

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

input:

3000 500 459
405 4762442
77 116618680
254 805723396
206 846119970
138 415876340
143 374308795
65 921080779
391 420070782
255 153808234
366 775778518
354 323151721
474 575429668
231 378727825
178 13556540
265 426366050
206 395282408
121 276279182
268 113272420
220 892637820
218 968081376
24 545347782...

output:

460875644145

result:

ok 1 number(s): "460875644145"

Test #26:

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

input:

3000 3000 1123
2006 392902738
1337 679829030
286 921787343
270 240243524
1758 110206510
2323 449831592
1610 263249990
2063 940608857
1872 351221360
2785 890423328
2200 930205448
2396 350502927
2195 439948015
1794 954001143
1225 568246284
1390 922613232
1729 734554054
752 126982613
2181 167748492
242...

output:

926856325003

result:

ok 1 number(s): "926856325003"

Test #27:

score: 0
Accepted
time: 34ms
memory: 238276kb

input:

3000 10000 2445
9916 60955521
1311 546281196
8271 450785814
3811 340452615
6033 10211620
7021 920120703
5451 129814122
5163 99511373
5958 811056057
2900 348514492
529 300995446
5984 886829548
6799 628556572
8875 909284688
6902 228353975
4150 707453233
2608 433754217
5158 506050856
8125 823984360
320...

output:

1452952580705

result:

ok 1 number(s): "1452952580705"

Test #28:

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

input:

5000 50 190
32 301560068
25 260590756
20 793682711
25 774688866
21 798409351
36 568928995
16 140895703
49 33931946
8 550492078
29 119454880
7 247200596
2 949932689
29 38541113
4 807113645
50 581781359
41 386954504
25 697623595
18 775647258
42 17994312
48 533514559
37 208527299
44 681080887
16 176062...

output:

218126002582

result:

ok 1 number(s): "218126002582"

Test #29:

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

input:

5000 100 3823
75 238927298
46 491346873
89 944707958
51 132950824
94 748190908
11 629795367
94 489612547
21 25917789
34 250108876
75 86927046
55 129101614
66 978313264
48 206613585
69 457575361
76 737701875
6 735129199
21 383731430
2 217589894
87 309653136
24 863860774
90 549312873
77 333911491
4 62...

output:

2320118624303

result:

ok 1 number(s): "2320118624303"

Test #30:

score: 0
Accepted
time: 7ms
memory: 393096kb

input:

5000 500 2394
177 609530601
441 263519695
141 714052787
380 426752854
472 5041178
156 86028432
59 667942223
446 859422471
9 38799061
498 230471640
472 44307459
11 772601396
80 353957765
247 407208418
70 393194460
152 377208763
342 727453657
293 480928813
229 212002086
90 744397754
12 42817213
419 44...

output:

1852150745930

result:

ok 1 number(s): "1852150745930"

Test #31:

score: 0
Accepted
time: 12ms
memory: 393612kb

input:

5000 3000 3487
285 71925064
766 32086712
214 746225157
176 494708026
178 388471010
1819 825072993
390 876221089
2888 249496048
2431 912706087
796 775567375
2827 157817601
1145 463150028
2734 264709594
2235 219656853
2126 385874182
2349 745884095
656 425088251
1641 631146243
169 124973778
171 8716049...

output:

2301328281584

result:

ok 1 number(s): "2301328281584"

Test #32:

score: 0
Accepted
time: 40ms
memory: 394712kb

input:

5000 10000 2172
8227 747323497
702 815922265
8451 123648405
4457 539848585
4182 870140159
8465 78872716
5652 273183820
182 634774225
6376 694996312
8639 794167613
4962 312102064
8628 526205097
1781 717320216
5797 792980065
6361 268318983
5921 250880678
3194 769077542
2128 53030189
311 443053269
6826...

output:

1744764005003

result:

ok 1 number(s): "1744764005003"

Test #33:

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

input:

500 100 6
69 129626760
5 449978106
61 989261186
72 638069575
26 280608378
52 685908155
81 932855739
82 82350114
21 792779442
77 493204907
56 830543473
59 105028460
89 731643951
16 264908763
29 925524933
44 662702166
98 466470962
79 202167196
63 116753433
24 790841938
83 993709118
27 951733632
53 415...

output:

20882560809

result:

ok 1 number(s): "20882560809"

Test #34:

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

input:

500 2000 0
717 749378724
1821 456186461
914 854370780
630 531878947
686 546997860
225 813872363
1274 323198011
508 992548471
1127 940365060
505 811316843
614 469644931
556 683679438
1169 918875427
910 990336141
992 634221171
1549 40563192
1349 393030052
1801 143794499
1953 806679053
1977 280975110
6...

output:

16556234961

result:

ok 1 number(s): "16556234961"

Test #35:

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

input:

500 10000 6
2164 103861995
3931 307468016
3010 393436072
3416 653030414
6970 794867887
1656 84454065
2169 732024599
6555 453581890
7342 410350010
3201 783977518
4349 922318777
6290 401288294
5183 135437558
8855 659116512
3520 255820440
1262 608543507
496 19150219
2425 358615167
6883 685038845
8879 7...

output:

23324356892

result:

ok 1 number(s): "23324356892"

Test #36:

score: 0
Accepted
time: 3ms
memory: 79584kb

input:

1000 100 9
18 324358277
17 197544843
11 247666199
6 821941951
33 274893936
90 501323389
7 405955067
6 587405899
13 39935735
22 292638914
15 836533241
89 878937103
55 551121000
24 815495796
60 539203840
19 916500680
83 626606672
36 777244403
65 816148796
93 601676404
27 114182523
38 509405915
4 54512...

output:

31453001024

result:

ok 1 number(s): "31453001024"

Test #37:

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

input:

1000 2000 0
1559 285284491
620 972940250
918 830450462
53 954874373
1887 992335200
1535 722743285
1325 526209682
383 719486309
1934 558122635
509 628480486
38 629143091
1845 222671706
746 18702856
1034 264442490
310 898046108
255 836353362
552 64853268
428 83281856
930 235094955
1391 261381112
507 8...

output:

30955836975

result:

ok 1 number(s): "30955836975"

Test #38:

score: 0
Accepted
time: 7ms
memory: 81840kb

input:

1000 10000 8
8901 374587545
7728 686705536
8090 632699030
8973 846089348
3693 855315786
8280 466401395
3762 691477129
7041 299407306
1348 72339995
266 48085564
6096 845178428
3340 512295215
9113 834760223
7761 585397824
4738 188388966
6971 458993083
3511 658239404
7788 959071523
5940 499882747
9580 ...

output:

34688476173

result:

ok 1 number(s): "34688476173"

Test #39:

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

input:

3000 100 4
95 929126436
78 344445858
98 596187078
81 402574836
60 159026070
98 213043026
1 447783807
58 731790292
68 365118050
47 337266628
37 702913172
29 76108832
3 526350941
1 914180379
68 211064953
69 603459740
8 77781147
69 849933501
74 430480358
60 232768589
11 51843442
56 346787151
100 879520...

output:

42863706412

result:

ok 1 number(s): "42863706412"

Test #40:

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

input:

3000 2000 8
838 819082624
345 30230637
1550 949855572
959 64114683
306 270599699
222 247727789
401 844213485
719 883149308
1982 824640067
1520 513624533
1665 1979436
1890 480542999
1477 253529843
1771 825065496
1211 155865494
21 364656929
182 605644361
317 437702381
622 897352945
133 154146094
1357 ...

output:

54423020406

result:

ok 1 number(s): "54423020406"

Test #41:

score: 0
Accepted
time: 19ms
memory: 238220kb

input:

3000 10000 8
9916 60955521
1311 546281196
8271 450785814
3811 340452615
6033 10211620
7021 920120703
5451 129814122
5163 99511373
5958 811056057
2900 348514492
529 300995446
5984 886829548
6799 628556572
8875 909284688
6902 228353975
4150 707453233
2608 433754217
5158 506050856
8125 823984360
3203 7...

output:

51014870332

result:

ok 1 number(s): "51014870332"

Test #42:

score: 0
Accepted
time: 3ms
memory: 392996kb

input:

5000 100 4
75 238927298
46 491346873
89 944707958
51 132950824
94 748190908
11 629795367
94 489612547
21 25917789
34 250108876
75 86927046
55 129101614
66 978313264
48 206613585
69 457575361
76 737701875
6 735129199
21 383731430
2 217589894
87 309653136
24 863860774
90 549312873
77 333911491
4 62397...

output:

45754238305

result:

ok 1 number(s): "45754238305"

Test #43:

score: 0
Accepted
time: 11ms
memory: 393304kb

input:

5000 2000 5
1924 203137653
773 382488320
1479 334101898
569 613546481
21 403640007
718 622969190
181 311960391
1248 781971091
541 826316282
532 103801284
1100 524558885
639 888157396
17 783324126
509 90721206
1409 973493393
1276 333151984
1301 1211262
206 792122907
313 854578232
1579 46911077
1503 5...

output:

64438494935

result:

ok 1 number(s): "64438494935"

Test #44:

score: 0
Accepted
time: 23ms
memory: 394684kb

input:

5000 10000 8
8227 747323497
702 815922265
8451 123648405
4457 539848585
4182 870140159
8465 78872716
5652 273183820
182 634774225
6376 694996312
8639 794167613
4962 312102064
8628 526205097
1781 717320216
5797 792980065
6361 268318983
5921 250880678
3194 769077542
2128 53030189
311 443053269
6826 59...

output:

73081922809

result:

ok 1 number(s): "73081922809"

Test #45:

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

input:

1 1 0
1 1

output:

1

result:

ok 1 number(s): "1"

Test #46:

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

input:

1 1 1
1 1

output:

1

result:

ok 1 number(s): "1"

Test #47:

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

input:

1000 500 905
361 8354603
106 3957352
466 15147937
261 12591023
116 1596880
4 180534
164 2575585
265 11767920
181 436276
381 12852758
419 19169051
395 6869254
496 17783581
366 17529806
137 4788276
470 23026406
42 1130511
363 6897795
402 6482129
8 164341
32 627024
349 4217034
486 6806391
10 299848
324...

output:

6305225453

result:

ok 1 number(s): "6305225453"

Test #48:

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

input:

1000 500 5
13 609348
83 4106606
435 21702624
249 12407883
298 14890023
248 12380624
202 10095908
387 19322538
239 11934294
122 6090699
400 19976560
74 3665815
12 595098
226 11294119
304 15164398
36 1785993
474 23689516
463 23106717
477 23819366
415 20737337
443 22101317
304 15175223
273 13629010
346...

output:

149722171

result:

ok 1 number(s): "149722171"

Test #49:

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

input:

1000 3000 340
1169 33107297
1839 14441572
1475 48523380
2087 71779129
1457 54092034
2085 90382541
1889 16629205
1447 9893244
1401 48827001
472 2505364
1278 28121824
2973 28324905
968 38191455
1594 63502578
1892 56079
2531 32779834
297 14202893
1899 71816624
75 1416186
760 14560007
2772 103961115
116...

output:

26919228317

result:

ok 1 number(s): "26919228317"

Test #50:

score: 0
Accepted
time: 6ms
memory: 80316kb

input:

1000 3000 822
1717 85820555
2212 110590826
2548 127395363
779 38939092
1640 81978282
932 46582631
130 6482232
364 18173670
2959 147940427
1521 76019112
2056 102779334
1653 82638762
2176 108785676
2751 137534186
1762 88099497
2097 104822125
2241 112022297
1307 65318649
1446 72253423
975 48708812
2886...

output:

73091899363

result:

ok 1 number(s): "73091899363"

Test #51:

score: 0
Accepted
time: 18ms
memory: 81920kb

input:

1000 10000 131
4671 172444926
6269 245316782
250 7980030
8202 311093877
4206 74663966
5421 224526343
6547 147379241
2538 78829736
9831 267859932
454 22614352
6664 231853577
3468 88705610
5037 246627062
3308 64487925
2334 40576683
6967 71904758
839 20061640
4180 196900516
7770 183000092
5310 35435019...

output:

45490992899

result:

ok 1 number(s): "45490992899"

Test #52:

score: 0
Accepted
time: 7ms
memory: 81860kb

input:

1000 10000 613
3515 175725480
9939 496941844
6323 316102013
4894 244678032
8388 419357110
3677 183809138
8789 439423756
455 22734355
7389 369407950
3206 160260805
4442 222061087
2043 102119467
1054 52671283
2361 118002238
9500 474995909
4533 226614346
6976 348787940
8780 438985246
5140 256970034
542...

output:

214488235457

result:

ok 1 number(s): "214488235457"

Test #53:

score: 0
Accepted
time: 3ms
memory: 237300kb

input:

3000 500 985
48 841386
286 6677515
304 7076475
102 1493036
48 990769
193 1776089
287 13541648
387 15521040
123 2410190
110 5069795
63 215400
377 3588822
417 1048589
29 239956
113 85793
363 6479931
116 4056316
240 2244155
333 1465209
40 45466
260 297831
420 15264675
278 6436667
284 8425794
226 914383...

output:

12759096660

result:

ok 1 number(s): "12759096660"

Test #54:

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

input:

3000 500 2804
392 19554644
468 23352576
69 3422651
90 4459895
435 21701209
141 7026180
220 10968867
305 15218763
477 23808208
55 2733543
341 17022909
260 12952679
329 16410106
186 9254269
483 24105019
134 6665326
252 12558425
148 7361588
408 20352446
459 22918463
170 8463612
374 18698671
362 1806618...

output:

36518987318

result:

ok 1 number(s): "36518987318"

Test #55:

score: 0
Accepted
time: 3ms
memory: 237612kb

input:

3000 3000 2599
1687 70955930
2341 93953374
1974 53925799
1295 50950920
1260 15139814
676 14713070
616 23941764
2198 49646255
2850 50601332
1573 70893409
2753 47772364
2684 17443642
2355 27037653
1457 62335832
1985 27187006
352 16965723
288 385880
2177 37429366
2585 39334331
1774 47388481
2321 226164...

output:

112597067006

result:

ok 1 number(s): "112597067006"

Test #56:

score: 0
Accepted
time: 12ms
memory: 237524kb

input:

3000 3000 534
2636 131760675
818 40878436
47 2347783
2283 114117780
738 36882958
716 35763160
2346 117262087
1115 55743978
2112 105582054
814 40689861
2339 116947169
1363 68140203
563 28131874
1510 75475953
1151 57530424
2431 121508014
2720 135970693
481 24014095
956 47754273
1989 99404582
2436 1217...

output:

73210565441

result:

ok 1 number(s): "73210565441"

Test #57:

score: 0
Accepted
time: 24ms
memory: 238280kb

input:

3000 10000 130
9966 480162403
2239 78881620
6084 124399666
214 4722617
5392 126924167
6785 203917170
2610 78646555
8362 314342371
9553 148714365
7490 150252804
309 605455
3037 44492531
46 1096521
7650 277629697
7148 264465781
6300 117062128
2452 61960721
3243 147194140
850 42157136
6436 305037055
81...

output:

53430033526

result:

ok 1 number(s): "53430033526"

Test #58:

score: 0
Accepted
time: 31ms
memory: 238392kb

input:

3000 10000 1066
6107 305325660
8613 430606682
4861 243004354
6906 345256773
9574 478684607
6528 326367260
9043 452134174
6279 313922797
1303 65112383
243 12140745
8087 404338773
8908 445356388
6062 303090742
2510 125452521
7018 350885007
3866 193254420
8589 429412830
948 47378869
924 46194374
6547 3...

output:

434363207615

result:

ok 1 number(s): "434363207615"

Test #59:

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

input:

5000 500 668
131 1686681
171 2673485
142 3796501
443 19395048
493 24227763
86 4147453
306 5631902
305 8099969
361 6201400
42 869535
411 4711749
63 2734199
31 930893
489 17824298
292 826415
257 59264
382 15425225
425 9149026
456 2448289
380 17326591
487 10610127
298 2738123
366 623840
454 20819036
12...

output:

11380816973

result:

ok 1 number(s): "11380816973"

Test #60:

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

input:

5000 500 1594
476 23791427
148 7398547
215 10701189
431 21511908
175 8738202
138 6897543
47 2334929
223 11121883
124 6164826
283 14133284
485 24219258
138 6872248
47 2325115
245 12231714
458 22878345
27 1318851
314 15660038
38 1866459
327 16318230
491 24549588
206 10258612
457 22804824
154 7670652
1...

output:

33655958719

result:

ok 1 number(s): "33655958719"

Test #61:

score: 0
Accepted
time: 11ms
memory: 393628kb

input:

5000 3000 4812
2605 24463346
2139 95740984
2474 11995515
2800 1655415
2166 96687594
2267 49193598
2344 82687028
1053 23349267
2003 26492959
1266 29181454
36 1114391
1202 48438188
2549 124666554
1320 63077599
885 1000636
2982 107501612
2574 77751572
863 35792108
2798 109809373
1596 54760059
766 16371...

output:

183190636085

result:

ok 1 number(s): "183190636085"

Test #62:

score: 0
Accepted
time: 27ms
memory: 393512kb

input:

5000 3000 737
154 7676604
1320 65957534
546 27267498
2684 134189571
2348 117398034
715 35710985
1778 88874647
2970 148471181
1753 87623681
1211 60545202
2622 131054604
1073 53634749
758 37860775
1373 68617719
756 37761350
253 12643903
2711 135503681
760 37976837
1169 58446611
3 117648
1985 99220363
...

output:

102120744632

result:

ok 1 number(s): "102120744632"

Test #63:

score: 0
Accepted
time: 42ms
memory: 394708kb

input:

5000 10000 2299
6749 93621095
8210 257222266
1918 45884711
2227 65734061
2385 105525856
852 15932188
2864 112974269
4587 55830813
762 27986094
3039 145765449
9362 151433142
2606 58770941
2350 38065981
5095 245336876
473 3989470
9825 170209098
4065 184452906
8115 153537763
3930 140505668
7561 2632632...

output:

512110981177

result:

ok 1 number(s): "512110981177"

Test #64:

score: 0
Accepted
time: 36ms
memory: 394800kb

input:

5000 10000 3225
2890 144475841
4584 229171520
4887 244323991
6215 310718217
6567 328319000
7892 394582279
7810 390494592
2504 125178535
1025 51234112
7280 363979197
7140 356957947
8477 423817502
1070 53460202
2660 132976996
343 17108697
5903 295118685
7497 374805015
11 522492
6708 335392906
4968 248...

output:

1091177722018

result:

ok 1 number(s): "1091177722018"

Test #65:

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

input:

2999 6805 2971
5820 317518919
3715 292891829
2498 140915695
6182 697883695
1811 456849722
4613 698053004
6791 918067412
4414 288053666
2613 204834910
4684 22005116
1186 378341613
4357 882510040
6712 266896265
2593 637602473
5536 264128431
4614 965290902
3602 659328464
4377 751947897
5133 700994000
3...

output:

1505793460171

result:

ok 1 number(s): "1505793460171"

Test #66:

score: 0
Accepted
time: 3ms
memory: 159980kb

input:

2032 1527 0
150 43295876
507 167132429
269 810817309
80 367370562
1389 116385152
1002 124698540
1511 480967419
1297 943377621
947 359159535
227 446414488
79 388020049
100 608280739
1084 261394221
698 773239548
770 460220703
297 484639865
1120 719015896
1138 165569350
810 232587935
836 995274083
1496...

output:

33070573438

result:

ok 1 number(s): "33070573438"

Extra Test:

score: 0
Extra Test Passed