QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#637246#9447. Admired Personucup-team902#AC ✓67ms199340kbC++23781b2024-10-13 11:32:452024-10-13 11:32:45

Judging History

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

  • [2024-10-13 11:32:45]
  • 评测
  • 测评结果:AC
  • 用时:67ms
  • 内存:199340kb
  • [2024-10-13 11:32:45]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
long long dp[5005][5005];
int a[5005], b[5005];
int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int j = 1; j <= m; ++j) cin >> b[j];
    sort(a + 1, a + n + 1);
    sort(b + 1, b + m + 1);
    for (int i = 0; i <= m; ++i)
        for (int j = 0; j <= n; ++j) dp[i][j] = 1e18;
    dp[0][0] = 0;
    for (int i = 1; i <= m; ++i) {
        for (int j = 1; j <= n; ++j) dp[i - 1][j] = min(dp[i - 1][j], dp[i - 1][j - 1]);
        for (int j = 1; j <= n; ++j) {
            dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + abs(a[j] - b[i]));
        }
    }
    long long ans = 1e18;
    for (int i = m; i <= n; ++i) ans = min(dp[m][i], ans);
    cout << ans << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 3
2 6 5 1 1
6 3 8

output:

4

result:

ok 1 number(s): "4"

Test #2:

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

input:

3 2
1 1 9
1 1

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

11 7
13 21 9 5 16 32 15 29 20 40 4
24 34 43 39 18 30 11

output:

32

result:

ok 1 number(s): "32"

Test #4:

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

input:

35 6
46 96 10 18 91 16 36 89 16 68 2 43 85 53 20 14 3 89 27 60 86 74 42 14 65 15 72 18 39 48 40 59 6 60 39
29 91 55 47 76 35

output:

8

result:

ok 1 number(s): "8"

Test #5:

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

input:

20 11
12 45 14 46 69 65 42 55 18 52 90 87 73 24 97 43 49 9 91 4
28 24 69 47 19 1 32 45 80 94 11

output:

40

result:

ok 1 number(s): "40"

Test #6:

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

input:

21 3
40 28 40 38 89 29 70 79 60 88 31 67 40 95 54 58 19 17 35 47 90
87 24 64

output:

8

result:

ok 1 number(s): "8"

Test #7:

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

input:

31 2
77 41 47 88 52 83 94 100 68 69 42 33 58 100 36 19 52 90 57 30 50 13 23 81 100 95 70 31 86 52 36
48 38

output:

3

result:

ok 1 number(s): "3"

Test #8:

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

input:

24 3
73 73 91 74 74 8 39 52 37 91 54 72 39 88 96 62 98 10 63 71 51 91 73 31
3 72 42

output:

8

result:

ok 1 number(s): "8"

Test #9:

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

input:

54 52
354567715 885423943 332278115 67046378 493302195 569363718 108877394 246293714 183721606 801281076 261093995 897683144 214239210 462059871 539384345 904212428 430249401 624234755 835419221 642763261 5641394 325620087 908461250 973232000 801026625 279494929 924527311 412579705 2405772 705362535...

output:

1902376181

result:

ok 1 number(s): "1902376181"

Test #10:

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

input:

85 84
297766113 918155278 692003424 803856840 602278200 325528862 448992902 333488123 2556188 12170373 536504143 815031068 502717487 972128308 504877777 772900339 7408467 637679688 465367459 295441039 495350609 637327868 994779660 27811902 356935288 15817522 630853446 627101683 921988529 692943571 4...

output:

4346989854

result:

ok 1 number(s): "4346989854"

Test #11:

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

input:

232 128
634979074 173312952 882950529 637531730 126121000 149287411 812616981 731346571 619156789 536141185 83505080 89307842 979573065 1115326 491673083 32423922 561744136 895581540 326060957 801978979 179581254 951627583 620318045 726017954 181662221 548935733 373117019 325489093 854337142 7686817...

output:

546323547

result:

ok 1 number(s): "546323547"

Test #12:

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

input:

136 87
228440538 773094750 53657077 945094819 345827898 164982677 462464062 890171541 668262762 152758721 99115455 459883937 475675203 665252460 24487115 311815001 814623127 88904041 635332195 739508481 357433155 867267023 111593145 792764184 999094500 606625607 377962717 162748390 491757872 3837392...

output:

833611469

result:

ok 1 number(s): "833611469"

Test #13:

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

input:

222 185
112967684 272312637 470829899 834606718 945669046 333176272 129985548 676236237 810112344 511835225 668870113 696838970 470491472 515381650 144101376 624006036 433056928 565700810 823399998 499136715 919635420 872688078 973372825 801862525 369822523 789469643 388576912 314381054 992594555 88...

output:

1312430159

result:

ok 1 number(s): "1312430159"

Test #14:

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

input:

2134 1597
299532488 540857248 963231209 221448350 293258199 315580728 754429230 948608319 341413702 63776327 294379633 909902563 501326054 134900574 604949406 123339921 652324489 713660285 792233097 663041476 445434446 288732077 480709339 448380559 411937790 535118792 80015105 489098310 781628874 67...

output:

1094650428

result:

ok 1 number(s): "1094650428"

Test #15:

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

input:

1577 1014
246780220 844226780 495027328 572644815 493433271 624882807 136553192 463221125 729219097 296181447 54477580 776645035 667488376 22555101 52710408 66822869 686919153 178109796 972870874 100291060 890924349 435796532 439335231 858440628 845210241 917929002 110216566 205179225 662230913 7809...

output:

609597621

result:

ok 1 number(s): "609597621"

Test #16:

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

input:

1080 569
273033994 783516939 199470369 276518816 297128404 937606753 121695985 939987951 414043302 978752031 160640594 499510676 762347006 878683437 861218660 462237840 309283858 149625439 51402636 635677158 94850681 722529493 606906890 810510400 759519879 607808585 932921140 827484830 433431435 417...

output:

480040442

result:

ok 1 number(s): "480040442"

Test #17:

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

input:

3050 1358
714148536 408333066 569837870 561757294 42977819 773698541 537896002 585693568 760492948 856051916 597850732 1268411 917089031 219753557 799901483 696586158 516447482 877670624 71776684 538660198 544625454 944701864 183884154 311999842 700011940 111515491 561366826 996583311 277003201 9219...

output:

357246012

result:

ok 1 number(s): "357246012"

Test #18:

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

input:

3117 3096
333545722 970630984 35423653 512357349 854273593 774355533 842533908 275240882 293728136 697619123 697621061 730201431 700141632 143765288 344084138 922379415 820122036 167262379 122709930 801492390 591422923 416998318 177848642 878622890 917355458 134338970 829747390 879313532 713815494 1...

output:

18589873225

result:

ok 1 number(s): "18589873225"

Test #19:

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

input:

5000 4016
990660846 596123531 489270206 449459476 291676406 573931365 641642651 498901947 195115114 92192029 61980093 169845853 593476105 565089840 218512023 334525788 262722667 353477634 958818633 147469340 321060339 508446082 615868761 35087587 232813608 183096419 872792124 630177235 138099074 675...

output:

1819646739

result:

ok 1 number(s): "1819646739"

Test #20:

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

input:

5000 2261
23968964 193185732 951065284 833435164 582705387 526321821 405695151 257815229 552287577 872984305 638937831 136148794 108946476 333613065 214734309 193262580 95157569 511686992 325001729 179403159 161844522 332833925 818618864 673254339 294339530 235899846 513890957 859819485 568623732 55...

output:

361237772

result:

ok 1 number(s): "361237772"

Test #21:

score: 0
Accepted
time: 16ms
memory: 63768kb

input:

5000 1492
770667687 64198529 947877706 946902893 669348154 141339469 375533498 137053950 289517839 802117795 365178119 40382907 110685497 570309777 976905478 264145608 646526904 984155128 776187102 487209613 176811277 623498511 493018841 102000334 627663232 696266160 506958617 312106447 344238528 29...

output:

201935110

result:

ok 1 number(s): "201935110"

Test #22:

score: 0
Accepted
time: 39ms
memory: 160052kb

input:

5000 3950
543151709 871531590 919210363 171214423 548363616 421223012 315311945 531960643 688096037 630646361 367841155 774614196 894915655 945683417 574718072 978933722 998297082 89314760 22093664 887273337 276530191 488308029 384286393 144330395 178169479 902221232 250206354 445202449 684525792 75...

output:

1486602559

result:

ok 1 number(s): "1486602559"

Test #23:

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

input:

5000 89
42235020 100635807 242627833 848285402 917936979 244277602 658657170 846597729 615119701 330538049 886536578 778715157 26548654 600371026 483910149 557303054 342502188 104349529 382136128 512048539 519690607 624039500 995486376 94419252 987686651 952047 968668400 336270893 601681571 96653201...

output:

9175200

result:

ok 1 number(s): "9175200"

Test #24:

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

input:

5000 2645
398235528 511724817 960734908 142048560 482065876 699119625 146754411 116417098 264555266 15456145 999649552 271699756 907565570 951932173 370853058 929793809 879782064 529546971 923700026 467044416 562761524 814944077 114393170 608135722 422965261 606270057 844684808 676911159 551229331 2...

output:

471282088

result:

ok 1 number(s): "471282088"

Test #25:

score: 0
Accepted
time: 39ms
memory: 147540kb

input:

5000 3670
238901173 491336545 818680697 638739747 28168073 974392168 972608974 361108575 363033603 504724494 344165008 134086262 877451328 554257344 692853342 56043137 245415946 463460359 455057641 964496917 19366236 144555932 747535964 421466543 113370168 594418687 300946565 684929270 20151147 4516...

output:

1075049085

result:

ok 1 number(s): "1075049085"

Test #26:

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

input:

5000 957
538532707 549367864 119749972 445593762 818872442 640172491 485984767 692460416 968328619 513220120 322480261 750763423 540674009 31016983 537640480 586102608 119035464 248017864 170481421 538057649 81269226 92281890 498532096 421488702 485796481 48630273 211470628 101400608 211736358 27256...

output:

116594751

result:

ok 1 number(s): "116594751"

Test #27:

score: 0
Accepted
time: 59ms
memory: 183292kb

input:

5000 4567
89503026 13725440 902711448 973073901 291340379 295026290 139404827 72268512 214878806 474331608 632037992 134671659 181809903 883543460 939255039 980884796 572550177 682447624 187057941 673783497 597955045 680706775 993379856 123626191 94955261 332721906 9657354 176133330 173348086 399714...

output:

3002731963

result:

ok 1 number(s): "3002731963"

Test #28:

score: 0
Accepted
time: 32ms
memory: 127968kb

input:

5000 3128
808100578 273448085 226951612 444777409 64724101 117498302 182739894 407783248 992731559 387203920 860833030 423405371 487006063 587471163 571761055 672472884 45318824 390513703 653781089 498682948 809366215 856555407 470097785 341126779 610170583 902574056 811418608 991377803 834851368 76...

output:

682772363

result:

ok 1 number(s): "682772363"

Test #29:

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

input:

5000 2500
836205697 782125691 245055934 661151796 703807974 366661926 937906820 675925344 968467982 600327135 625954923 781708212 744670742 205361297 307068534 303609377 147624551 588178552 455666907 272982927 804954681 606051471 198097556 631941426 465132724 451179368 661552936 654649455 940637188 ...

output:

381369378

result:

ok 1 number(s): "381369378"

Test #30:

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

input:

5000 2500
899013695 907943980 675388685 538783160 269743128 617887452 483192876 119217982 974084827 981808488 870626675 548668474 768012325 338648162 633956364 566143851 559376307 633897590 561934082 672749075 198272654 353579638 331686797 672161974 424539711 777168794 686350288 156687996 446159730 ...

output:

386809836

result:

ok 1 number(s): "386809836"

Test #31:

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

input:

5000 2500
726321889 800901055 122502573 343630942 627677591 743568457 753677086 998204980 494810676 503482191 745585541 295069522 499685915 292333992 694523212 898906016 171916447 840190098 102218418 877737730 878819047 798911270 520196081 335568610 415541832 200712560 558898890 126142836 322247243 ...

output:

372129474

result:

ok 1 number(s): "372129474"

Test #32:

score: 0
Accepted
time: 25ms
memory: 103256kb

input:

5000 2500
809787493 226744169 564012272 167408230 232506220 191514407 584364003 769051274 620394829 748746998 816336373 772112735 534770731 478583806 172650322 289525341 734166089 568126165 590122773 919934549 337410647 236136406 737306487 735454403 745983093 534275045 737523792 216163565 398418638 ...

output:

413850822

result:

ok 1 number(s): "413850822"

Test #33:

score: 0
Accepted
time: 26ms
memory: 102188kb

input:

5000 2500
563169355 224910211 300668141 106386576 556095500 254207340 923751677 536672967 237201149 716032995 747893181 424869356 202110601 433445457 459227355 848951583 253866993 572257169 226696877 264392545 307800352 792122848 763549167 488279301 781158900 102326949 554343003 864761319 753869541 ...

output:

389982519

result:

ok 1 number(s): "389982519"

Test #34:

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

input:

5000 2500
612616713 441469541 686134201 750044224 211107988 254931652 212369983 278829738 288050992 650852790 480847716 432561331 632115606 171350513 992213771 732300826 357163805 441247854 597611267 202727713 561268489 223537356 849405869 372867434 231651876 864931925 400019112 229629034 153031363 ...

output:

401220301

result:

ok 1 number(s): "401220301"

Test #35:

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

input:

5000 2500
832878918 703534264 574470746 923055114 171397250 703980707 842373625 293534708 473862377 684253711 283161676 742965517 283749321 293370467 934697764 428412327 693015502 439944790 171851089 815460015 120431867 974763779 581794694 536339447 893559853 513268080 934522968 711841425 895429501 ...

output:

390669856

result:

ok 1 number(s): "390669856"

Test #36:

score: 0
Accepted
time: 28ms
memory: 102420kb

input:

5000 2500
422508676 254609310 163477106 734106613 642254856 930525554 527738215 394679575 682343849 396365747 975198585 373394775 504729071 227061231 852170752 671349201 292910453 719426827 879719363 898128350 914162011 634014697 950868472 552820337 501066043 939566994 661182351 143604036 661117828 ...

output:

405140235

result:

ok 1 number(s): "405140235"

Test #37:

score: 0
Accepted
time: 32ms
memory: 102040kb

input:

5000 2500
383799267 353117288 821242224 546630083 748084040 411411099 568701557 597059706 471100315 890491720 486764277 445548699 941211008 374829834 339769415 151502712 270187649 207982620 340229431 366807263 383831111 888319396 483745212 812394546 826100900 602019029 628729637 171694579 332480092 ...

output:

372106756

result:

ok 1 number(s): "372106756"

Test #38:

score: 0
Accepted
time: 32ms
memory: 103140kb

input:

5000 2500
986535267 856697986 524901571 945390015 818190359 793542556 884189953 873415238 171406581 860806824 862665133 956751614 646540169 300124134 626945742 254542372 112191964 999400886 193308172 667392897 371293778 626761071 372002346 724494985 160904989 454200730 327016432 560490535 101142833 ...

output:

380178819

result:

ok 1 number(s): "380178819"

Test #39:

score: 0
Accepted
time: 28ms
memory: 102852kb

input:

5000 2500
179785003 931902473 692596724 917735708 962462186 893127842 768651968 351709828 303550758 236148438 202979990 613556038 699570179 773880474 180389046 431498965 657028630 125233716 788935543 881605207 381253753 520328027 405701385 168569054 415122365 666931859 138829280 942438902 610949646 ...

output:

383169988

result:

ok 1 number(s): "383169988"

Test #40:

score: 0
Accepted
time: 26ms
memory: 103376kb

input:

5000 2500
206096181 847103863 337758238 709397629 896446463 710140293 493498429 452213669 216478734 326746500 318710705 552565497 307941970 876748108 352377849 534322124 455038721 452487464 523175601 493489520 302480106 495319677 997157747 717238613 609620260 121521922 276606140 497003229 301586977 ...

output:

370532421

result:

ok 1 number(s): "370532421"

Test #41:

score: 0
Accepted
time: 29ms
memory: 102452kb

input:

5000 2500
605221852 213343132 240041441 134438581 162404807 965579916 847431837 481299735 513460303 943989459 901357381 569818709 621419507 790640968 553653947 964007736 193606341 310010162 351435696 805675602 911419063 894546091 982851197 141825839 839731907 991336869 753874445 710764323 244152404 ...

output:

393180082

result:

ok 1 number(s): "393180082"

Test #42:

score: 0
Accepted
time: 28ms
memory: 102692kb

input:

5000 2500
416709629 500523916 417981497 401972922 855058999 895742876 696122046 128336217 679179711 903789556 645194641 947368168 779002898 373623334 680371638 535411998 518940040 700123993 727019022 706455328 837317437 139787048 933518325 685607496 487647877 906242371 646343317 925804473 208983956 ...

output:

397663902

result:

ok 1 number(s): "397663902"

Test #43:

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

input:

5000 2500
607152436 448413715 775161266 231815317 390659341 760005892 660292127 213994797 455148458 149345172 515634868 984681415 837520303 328138843 584949960 953545758 452801149 426570279 872227647 612659291 660320476 690456440 379462696 482804086 809475520 352131479 688540425 389253296 750919290 ...

output:

378561058

result:

ok 1 number(s): "378561058"

Test #44:

score: 0
Accepted
time: 47ms
memory: 198556kb

input:

5000 4967
920751624 305375883 292739447 186842049 633217226 626696270 550663179 415264303 25287771 883546915 997314820 760314905 11166862 850363942 563094006 313290 970489333 875912363 458676353 580905561 819104465 244824162 181014679 403115574 926287757 373889271 419826575 467723807 170126002 18725...

output:

15251985139

result:

ok 1 number(s): "15251985139"

Test #45:

score: 0
Accepted
time: 55ms
memory: 199180kb

input:

5000 4960
510507195 897256600 561506966 130690821 718591086 986093498 68366760 136384175 843777876 466498968 764548834 303842810 366369973 744520262 838574189 964736742 828887944 393256719 584752591 784597421 105511940 591424982 451603931 900059819 430568465 618042689 65065081 479631641 589112869 24...

output:

13720102919

result:

ok 1 number(s): "13720102919"

Test #46:

score: 0
Accepted
time: 61ms
memory: 199216kb

input:

5000 4961
342016199 526266994 557967989 780638094 133104512 483306430 74274233 639026721 556372797 813791738 74384420 343455983 28654742 563903463 680160027 394112405 823091319 679877879 882888967 676609423 848653093 799884097 404388059 838106682 713755298 241632941 233254507 77093147 771882488 8026...

output:

13757642995

result:

ok 1 number(s): "13757642995"

Test #47:

score: 0
Accepted
time: 58ms
memory: 197940kb

input:

5000 4963
967225178 776092276 816120457 558467410 584480657 776192418 576547221 582928083 451893367 395901554 364714440 837264542 518560427 956448660 43780598 307361489 52624361 768114587 103911365 534106544 247040548 924600585 570362403 787648837 924794948 615787470 816313397 579984520 371545504 75...

output:

28351144953

result:

ok 1 number(s): "28351144953"

Test #48:

score: 0
Accepted
time: 53ms
memory: 199124kb

input:

5000 4961
132096320 718501066 546860778 932820106 203156619 524276023 381706517 807769227 859515275 824475380 319470989 639794623 577608232 161728961 538083845 521545398 658998956 148535686 207807406 810654217 187564271 960450725 734493996 904587816 296944576 348711472 310837241 487538160 329991588 ...

output:

23448160105

result:

ok 1 number(s): "23448160105"

Test #49:

score: 0
Accepted
time: 54ms
memory: 198420kb

input:

5000 4951
390394204 792836640 69370442 899131793 939362836 645145328 312593993 914957723 637796118 274722822 176628304 769505174 926937184 113134327 925597891 152206766 486084182 589045283 184450308 163673708 59078250 790694433 572519392 532932557 916935686 595415327 945339289 159667894 257469128 10...

output:

15424801396

result:

ok 1 number(s): "15424801396"

Test #50:

score: 0
Accepted
time: 57ms
memory: 198876kb

input:

5000 4985
377121144 308766249 40113968 959328438 125835790 724472059 314856623 395548150 442119358 406631286 959059048 966907178 800175394 832316735 38880184 624215397 730553381 172914341 625954796 973611543 737546481 668095683 565895842 880077351 666419545 312323483 770745513 298478287 2770217 3881...

output:

23680568082

result:

ok 1 number(s): "23680568082"

Test #51:

score: 0
Accepted
time: 51ms
memory: 197884kb

input:

5000 4962
744173780 383951929 965444888 919537708 304184317 340994136 528323329 759051982 260048067 498640424 94673751 970084050 506780326 536795080 336108513 20044558 807687147 553746942 704469920 948591126 52450951 1087960 31732721 755888988 786699084 952655837 722322251 345007663 337936738 682242...

output:

17732117695

result:

ok 1 number(s): "17732117695"

Test #52:

score: 0
Accepted
time: 53ms
memory: 199112kb

input:

5000 4976
3494275 746213053 298274888 879202115 988705218 2849700 650259263 363145255 233767608 110847066 64574490 824203292 41455267 953970841 275016185 812212951 383265302 162723134 67288684 270763439 203271280 807662407 137933359 37359373 833757087 624564534 156056402 762415427 954901764 88864511...

output:

32833868494

result:

ok 1 number(s): "32833868494"

Test #53:

score: 0
Accepted
time: 54ms
memory: 198612kb

input:

5000 4982
338074232 845629086 441264153 229176879 263884459 552362955 616659324 437169643 968625111 682446090 161276003 441419907 462118388 449129337 111747754 170052177 839938102 355926760 245348198 398561546 622408629 428983066 815787283 327521110 646700106 673935672 171561351 434830160 303639976 ...

output:

21789660667

result:

ok 1 number(s): "21789660667"

Test #54:

score: 0
Accepted
time: 53ms
memory: 198856kb

input:

5000 4952
226989294 4365363 354203540 274218893 297019786 185797447 256468991 474652208 651653075 166623422 121169463 680658882 188433802 542264309 989385319 633169309 895097075 773583887 758381468 801879328 652230544 208476897 251629395 739940822 107595577 177631865 456485725 270251168 183458768 67...

output:

18921364367

result:

ok 1 number(s): "18921364367"

Test #55:

score: 0
Accepted
time: 55ms
memory: 198416kb

input:

5000 4979
941387860 319993748 835862145 570785761 386833978 11926954 740328304 177546207 90565139 636127274 143749125 72441000 966400975 882356161 311665165 443813122 956435423 895056566 92757527 976370391 934606407 160738064 878266473 295764057 555596614 653394342 441077060 68589573 659968392 33572...

output:

25124988689

result:

ok 1 number(s): "25124988689"

Test #56:

score: 0
Accepted
time: 55ms
memory: 198108kb

input:

5000 4965
94160857 939817584 771902200 411555470 335549294 284918833 816026841 58805122 495199431 243954465 596411132 501973152 273250021 119323838 799752388 338238543 385978592 667839981 563271218 791444950 301565132 343766604 954302998 488869767 161732144 591580526 918356696 856010280 971816304 62...

output:

20672710487

result:

ok 1 number(s): "20672710487"

Test #57:

score: 0
Accepted
time: 48ms
memory: 198512kb

input:

5000 4963
650884525 134505454 406618507 744282395 61968990 811890526 332969041 942021425 230902468 274821144 755375931 753693077 387244906 475942909 869619908 480142379 583160251 58965246 696507831 273747417 962857242 378635922 739894993 411089398 724611384 163760348 319866802 849772773 291001438 93...

output:

32744295519

result:

ok 1 number(s): "32744295519"

Test #58:

score: 0
Accepted
time: 66ms
memory: 198348kb

input:

5000 4979
328140284 315739289 198130083 298901904 680050195 695658031 433298150 324951670 411794966 771932701 924194180 182364509 541138494 321423613 171549663 238381540 347799302 12373177 723805500 577920069 34055899 73094164 132968264 340878345 729707639 990922480 698430472 375319999 843743551 963...

output:

24203752007

result:

ok 1 number(s): "24203752007"

Test #59:

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

input:

5000 5000
523782897 489651410 219874746 495211942 260205829 808633295 155491206 732804847 238310164 490447673 717773509 128070398 506527072 381292980 105874392 447685545 347959731 367190316 379351941 768836851 237821342 402190107 210320000 969869445 959340036 126725556 452354275 432160129 331556129 ...

output:

20262244477

result:

ok 1 number(s): "20262244477"

Test #60:

score: 0
Accepted
time: 47ms
memory: 199236kb

input:

5000 5000
159159914 115754440 744392902 651480496 293284223 558928276 620033338 329773141 721591884 760601959 346686729 446690576 805384924 320952807 654618392 418561347 483835461 181725842 350442640 221519166 215691471 817059927 948724276 259384190 957981924 923257289 348135408 872793263 455282588 ...

output:

41470989122

result:

ok 1 number(s): "41470989122"

Test #61:

score: 0
Accepted
time: 55ms
memory: 199180kb

input:

5000 5000
219210318 356264315 355904953 758550356 225133460 831588613 492214599 349719329 949733071 797488553 750639928 418547775 255730857 759698132 188451869 651895365 823544968 594142845 839541369 696149231 495187145 917176070 146560908 965141651 997704746 677320830 800081067 299599559 400339902 ...

output:

22466173988

result:

ok 1 number(s): "22466173988"

Test #62:

score: 0
Accepted
time: 54ms
memory: 199232kb

input:

5000 5000
661210944 624166587 789916118 182251652 597805126 114472373 671529303 132256130 370145318 651946674 612153508 749560183 524884559 751673644 612351814 861272058 637483068 187979577 230268082 156092864 107452618 802107603 535701164 707251838 265625705 632425826 246259069 481155498 236744288 ...

output:

22497611550

result:

ok 1 number(s): "22497611550"

Test #63:

score: 0
Accepted
time: 54ms
memory: 199312kb

input:

5000 5000
823621197 801573421 685531296 280696301 520862452 797847772 345582720 145213909 874707751 419836102 433814679 222298972 436980628 819046060 142915330 897204548 566373006 115808695 582514863 829068175 694021118 161472129 322454702 127163893 303291470 173262316 911623684 243139647 666370892 ...

output:

39553537196

result:

ok 1 number(s): "39553537196"

Test #64:

score: 0
Accepted
time: 51ms
memory: 199296kb

input:

5000 5000
511493125 379510485 212251985 154744812 204286871 502801751 139239227 316216963 516174820 395969864 893386199 815890773 799097896 955322141 243707575 547868780 500411128 669828824 509737978 659890543 980773677 658418971 944116610 890900591 916208233 668223867 378762863 531870913 724762194 ...

output:

14551326210

result:

ok 1 number(s): "14551326210"

Test #65:

score: 0
Accepted
time: 58ms
memory: 199232kb

input:

5000 5000
620058973 472732727 409161196 335554062 171025192 893252842 722043321 831710854 399227035 875834601 178303071 805988912 808511115 249503996 257810588 280265277 792843252 177131729 446596741 302050306 787855438 981883068 596924200 341134620 547924854 369105022 347560978 107807990 332393866 ...

output:

17985468767

result:

ok 1 number(s): "17985468767"

Test #66:

score: 0
Accepted
time: 51ms
memory: 199228kb

input:

5000 5000
273320476 354969924 984248063 118118114 742214350 543787434 624714013 326836892 764178822 333472651 622230691 465566751 229678393 982599672 209412458 749188177 715030658 153888783 644427073 931754674 356014174 446752460 771727488 502375343 396402204 643540218 332665440 384867641 182778447 ...

output:

30046553033

result:

ok 1 number(s): "30046553033"

Test #67:

score: 0
Accepted
time: 67ms
memory: 199340kb

input:

5000 5000
912677629 776932489 552552345 833943371 340176432 549786490 519116796 449645018 605482247 294834603 846369576 881490108 594268507 804058956 583986925 873943865 466105982 702607625 593490929 620215795 960956434 449989558 416808979 974412042 233073484 910466364 119415230 164744862 566445235 ...

output:

30606844126

result:

ok 1 number(s): "30606844126"

Test #68:

score: 0
Accepted
time: 51ms
memory: 199236kb

input:

5000 5000
792597693 154326090 478061461 848622184 752910858 490296116 318030253 927377195 871918846 791350001 659211520 305843947 123078718 363231949 423062426 971542569 130009399 883062174 172444585 185080065 890302183 522441389 491496344 576022019 151754837 212685230 993842586 190498716 693514542 ...

output:

42892796759

result:

ok 1 number(s): "42892796759"

Test #69:

score: 0
Accepted
time: 53ms
memory: 199112kb

input:

5000 5000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000...

output:

0

result:

ok 1 number(s): "0"

Test #70:

score: 0
Accepted
time: 54ms
memory: 199232kb

input:

5000 5000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000...

output:

4999999995000

result:

ok 1 number(s): "4999999995000"

Test #71:

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

input:

1 1
521366902
880233751

output:

358866849

result:

ok 1 number(s): "358866849"

Test #72:

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

input:

1 1
329627981
623409231

output:

293781250

result:

ok 1 number(s): "293781250"

Test #73:

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

input:

5000 1
668127271 23045131 772451854 550784646 309276525 26388112 49616875 687163089 688667274 567750208 907902235 167809887 734733895 641594612 765243894 174556172 302912599 442057776 445364436 185815830 565432072 601696129 206346380 951260579 894532758 952792883 878162322 692781847 546209278 720486...

output:

77546

result:

ok 1 number(s): "77546"

Test #74:

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

input:

5000 1
873515700 980159008 185391319 946868460 90632723 698269738 895097535 781315107 774235364 970345575 607263707 365091182 726707992 704101593 126836758 367863655 79029872 36423035 129101447 849527856 469640309 168528815 385300416 7145780 913782052 205638040 857350257 944239853 374691962 89443401...

output:

48199

result:

ok 1 number(s): "48199"

Test #75:

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

input:

5000 1
971926987 342509604 228990241 348285063 660373943 709363902 523626190 197389924 743959877 10109678 262150033 392902811 5321549 318694289 470699605 792247511 905297574 414678820 922484822 444205434 33830443 578822466 168265152 870188389 892609450 840001628 349866418 394661840 578301121 5825793...

output:

446396

result:

ok 1 number(s): "446396"

Extra Test:

score: 0
Extra Test Passed