QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#113727#2628. Self Studypdstiago100 ✓126ms8432kbC++201.3kb2023-06-19 08:17:032024-07-05 22:03:05

Judging History

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

  • [2024-07-05 22:03:05]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:126ms
  • 内存:8432kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-19 08:17:03]
  • 评测
  • 测评结果:100
  • 用时:119ms
  • 内存:8304kb
  • [2023-06-19 08:17:03]
  • 提交

answer

#include <bits/stdc++.h>
 
using namespace std;
 
#define MOD 1000000007
#define mxn (int) 3e5+5
#define mxm (int) 1e5+5
#define f first
#define s second
#define pb push_back
#define es " "
#define endl "\n"
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define fastio ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> pip;
typedef unsigned long long ull;

ll n, k, a[mxn], b[mxn];

ll solve(ll x){
    ll cont=0;
    for(int i=1; i<=n; i++){
        if(b[i]>=a[i]){
            cont+=(b[i]+x-1)/b[i];
        }else{
            ll qnt = min(k, (a[i]+x-1)/a[i]);
            cont+=qnt;

            ll resta = x - a[i]*qnt;
            if(resta>0) cont+=(b[i]+resta-1)/b[i];
        }
        if(cont>(n*k)) break;
    }
    return cont<=(n*k);
}

int main(){
    fastio;
    cin >> n >> k;
    for(int i=1; i<=n; i++){
        cin >> a[i];
    }
    for(int i=1; i<=n; i++){
        cin >> b[i];
    }
    ll ini=0, fim=2e18, meio, resp;
    while(ini<=fim){
        meio=(ini+fim)/2;
        if(solve(meio)){
            ini=meio+1;
            resp=meio;
        }else{
            fim=meio-1;
        }
    }
    cout << resp << endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 5664kb

input:

1 1
548641561
724453206

output:

724453206

result:

ok single line: '724453206'

Test #2:

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

input:

2 1
80304386 1597
1258971 98815137

output:

80304386

result:

ok single line: '80304386'

Test #3:

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

input:

3 1
718661397 138698100 479852432
476459687 907845291 453667817

output:

479852432

result:

ok single line: '479852432'

Test #4:

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

input:

4 1
40507275 25309 13 361883
8128172 62257460 3 1027728

output:

13

result:

ok single line: '13'

Test #5:

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

input:

5 1
991877575 974223811 527727300 578005153 205111294
310841900 329838723 543248627 534715774 830419619

output:

543248627

result:

ok single line: '543248627'

Test #6:

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

input:

6 1
673477 2620072 362852511 86 69304 4342089
247938 152093194 1 1775681 59980917 409

output:

673477

result:

ok single line: '673477'

Test #7:

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

input:

7 1
178014106 857686017 847502205 846499927 769922152 825294743 94179401
107076300 387039548 308448172 416996505 919652417 358968960 881155943

output:

178014106

result:

ok single line: '178014106'

Test #8:

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

input:

8 1
38952827 24114401 19 2 29754 391071941 895126917 27
66338173 5206521 1428592 7035 23684037 278 311 14429699

output:

7035

result:

ok single line: '7035'

Test #9:

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

input:

67 1
610928627 863614572 535107894 102892262 781620356 439829100 777321721 608856766 686478481 752884266 585966742 85481271 904743197 42797812 27698813 425144291 38360264 117768094 645740865 903621093 57241636 507954073 682213933 707630124 334595719 716583236 534534992 50416286 344293088 613848792 2...

output:

95375906

result:

ok single line: '95375906'

Test #10:

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

input:

4481 1
530263320 551405488 720280735 756921262 57615896 890005460 245664758 943419373 832394839 370240673 420526498 695670828 910866430 705658035 543576358 811997503 723914542 278031919 407895048 896804222 935879701 773845225 12699717 570880703 852422012 176717545 740287923 997989010 451013204 21496...

output:

12073279

result:

ok single line: '12073279'

Test #11:

score: 0
Accepted
time: 70ms
memory: 8364kb

input:

299999 1
353932896 283957966 10468088 561126160 702975326 865946692 549886847 881809173 22487130 377759910 103679048 7383003 533620194 601101806 658483835 596524345 643103064 242207881 180146144 156685989 785620097 337780504 174463500 517216117 937644576 779893031 616819943 353759011 10199744 587374...

output:

4481987

result:

ok single line: '4481987'

Test #12:

score: 0
Accepted
time: 76ms
memory: 8292kb

input:

300000 1
244960338 81301400 314994847 781781085 269762243 884560570 719108129 537499271 171153472 86878356 612696563 982213163 436289004 473491259 565304038 547393429 796429448 777777257 11490151 799145244 622205824 156454272 252970682 917967775 361170206 487728888 959769335 81559521 242249146 80493...

output:

1263603

result:

ok single line: '1263603'

Test #13:

score: 0
Accepted
time: 41ms
memory: 8376kb

input:

300000 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1000000000

result:

ok single line: '1000000000'

Test #14:

score: 0
Accepted
time: 35ms
memory: 8304kb

input:

300000 1
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 10000...

output:

1000000000

result:

ok single line: '1000000000'

Subtask #2:

score: 25
Accepted

Test #15:

score: 25
Accepted
time: 1ms
memory: 5740kb

input:

3 3
430074929 299686894 507918575
430074929 299686894 507918575

output:

1015837150

result:

ok single line: '1015837150'

Test #16:

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

input:

8 2
838643951 240217016 261207069 66687076 628994327 646228382 585174644 909710002
838643951 240217016 261207069 66687076 628994327 646228382 585174644 909710002

output:

466809532

result:

ok single line: '466809532'

Test #17:

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

input:

5 3
97283122 448906411 242495629 994021326 237073930
97283122 448906411 242495629 994021326 237073930

output:

583698732

result:

ok single line: '583698732'

Test #18:

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

input:

8 9
605252877 430369638 951054166 725102459 957083940 702833150 560462831 778843323
605252877 430369638 951054166 725102459 957083940 702833150 560462831 778843323

output:

5706324996

result:

ok single line: '5706324996'

Test #19:

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

input:

5 6
177261053 471738378 620494299 22899748 431624268
177261053 471738378 620494299 22899748 431624268

output:

503794456

result:

ok single line: '503794456'

Test #20:

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

input:

5 3
210207442 280126392 78641217 947623685 74849413
210207442 280126392 78641217 947623685 74849413

output:

374247065

result:

ok single line: '374247065'

Test #21:

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

input:

1 2
277396200
277396200

output:

554792400

result:

ok single line: '554792400'

Test #22:

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

input:

2 9
663859439 355600750
663859439 355600750

output:

3983156634

result:

ok single line: '3983156634'

Test #23:

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

input:

150000 2
105295735 817188254 945364397 912402231 203758571 794613367 528387081 254379958 377098879 754454786 265063605 399253822 50069142 552324889 687426901 465038712 67694214 627282227 218124305 72659729 829014661 252082800 673784906 429311574 410894912 800771330 865107863 35065584 128252901 35948...

output:

81081684

result:

ok single line: '81081684'

Test #24:

score: 0
Accepted
time: 21ms
memory: 6520kb

input:

100000 3
477721927 368835451 739967201 967746671 348354695 694651745 320318398 425176124 75735246 581329106 338055205 267807461 83980603 539036952 384773331 818445431 534294342 809121868 340460138 731645448 459444180 626832563 389107488 814874553 899637777 802059908 762583175 987018364 142559064 629...

output:

110677572

result:

ok single line: '110677572'

Test #25:

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

input:

75000 4
868250486 799799349 933909985 630919106 33530455 700944860 79525162 834134337 441386423 77353305 511360916 17997903 282872826 198810305 31393333 725207410 711626485 516179318 342711711 32564225 427023013 233428207 509188994 561521037 38936290 784185485 867008799 374585575 125011263 839928624...

output:

47418300

result:

ok single line: '47418300'

Test #26:

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

input:

60000 5
161564185 390907347 426181889 867402696 959889814 958540714 154891379 152599226 105497775 145400383 336544259 797805881 781066373 261096516 642200980 598023441 263758200 974489698 622974811 342002810 360018925 103239418 856523517 873592867 6029039 320181433 389071113 245496447 134675885 6590...

output:

400175093

result:

ok single line: '400175093'

Test #27:

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

input:

600 500
406068791 554338297 164087338 103512 395342101 570279441 294543639 102643657 563673633 827344200 224536735 878783159 849667806 685930945 831952784 583591196 871947668 341243305 865502137 925604982 467471388 337964327 581496974 680683382 180217152 815037215 960839910 215272921 971689310 73290...

output:

18380352124

result:

ok single line: '18380352124'

Test #28:

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

input:

8 37500
995879700 388051689 83290852 679821958 189503537 126482058 183850314 717981325
995879700 388051689 83290852 679821958 189503537 126482058 183850314 717981325

output:

8091956144356

result:

ok single line: '8091956144356'

Test #29:

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

input:

5 60000
395236873 364004629 416840897 545512109 647978992
395236873 364004629 416840897 545512109 647978992

output:

27142497016402

result:

ok single line: '27142497016402'

Test #30:

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

input:

1 300000
1
1

output:

300000

result:

ok single line: '300000'

Test #31:

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

input:

1 300000
1000000000
1000000000

output:

300000000000000

result:

ok single line: '300000000000000'

Test #32:

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

input:

4685 64
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

64

result:

ok single line: '64'

Test #33:

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

input:

4685 64
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 100000...

output:

64000000000

result:

ok single line: '64000000000'

Subtask #3:

score: 27
Accepted

Dependency #2:

100%
Accepted

Test #34:

score: 27
Accepted
time: 1ms
memory: 5660kb

input:

3 8
601047763 838215942 318811201
697100290 122519868 465324773

output:

4879702030

result:

ok single line: '4879702030'

Test #35:

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

input:

4 6
810910987 453591906 621051618 105786577
986713368 510042379 648884803 130740478

output:

1946654409

result:

ok single line: '1946654409'

Test #36:

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

input:

5 6
975483724 625339932 524592677 530663364 521436582
65641922 593191031 95399567 722601840 543004494

output:

3338355196

result:

ok single line: '3338355196'

Test #37:

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

input:

9 4
19 3179035 379 1078 2930 1466 53819 18615 3018
22875870 22 567528992 340217 15 5 899831 568 161692

output:

5974

result:

ok single line: '5974'

Test #38:

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

input:

5 8
241571261 251099171 835099887 794555722 102369842
78987084 262941678 208761184 229115966 996913694

output:

2722440928

result:

ok single line: '2722440928'

Test #39:

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

input:

8 7
5045782 510 26484387 515719 49464 35550350 23 7166572
123201 14734 544311 49729008 19 1 18830079 65242

output:

346609

result:

ok single line: '346609'

Test #40:

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

input:

9 5
299576691 180035319 766560165 761733876 728542550 336686114 935876415 729148769 111233983
227748551 862700978 942302335 361775723 211299018 543371636 694434966 704462207 392852238

output:

2716858180

result:

ok single line: '2716858180'

Test #41:

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

input:

5023 44
606550574 771464710 787346338 263002908 303748592 751922168 729056675 897969646 152347018 71265152 302447654 540689128 371691302 770184804 791840243 491627163 410709744 727155479 535125704 456344585 767324884 627388889 15302045 977186767 765771660 34840674 526973322 49563042 730470785 429612...

output:

16076014950

result:

ok single line: '16076014950'

Test #42:

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

input:

8953 3
15415774 526469272 122041186 124513826 287488913 202480277 838916532 886377383 281763660 493605898 445891626 893104672 327323026 258134348 503803778 332619916 6954393 472872778 267772435 505462156 777360035 399009922 73587783 857940333 799426230 330958500 578754759 596121607 67785025 97211341...

output:

962773319

result:

ok single line: '962773319'

Test #43:

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

input:

885 56
682266409 434213867 871708117 451900043 287952168 362247651 730852291 587473400 210781930 500660469 782612295 538522806 860551662 536099769 969783625 958237408 835707932 698706407 233052060 515309106 393746743 81185215 791554847 818378525 206807653 145264898 920522294 20560580 95029005 979122...

output:

19709604917

result:

ok single line: '19709604917'

Test #44:

score: 0
Accepted
time: 14ms
memory: 6128kb

input:

51317 2
24111733 552312317 496070170 688574576 454130969 452306720 498156801 724872610 878877437 236405628 288025286 58500421 163587791 664430347 295329773 673343666 153008983 291839755 73123934 773977725 307699475 801122737 2206855 326702553 230786360 214355176 305825909 866462232 576362540 9730361...

output:

577567893

result:

ok single line: '577567893'

Test #45:

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

input:

6 2783
702351819 225122134 172854936 864296765 296145216 734158285
682149596 254074483 132992866 609165793 849192601 324859557

output:

1057579360998

result:

ok single line: '1057579360998'

Test #46:

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

input:

166 1787
251941502 746836110 330110862 837577655 231341610 467597191 258938001 133009615 39625818 607638832 357424686 936819270 742213332 870554209 182427105 309606392 433943508 323470258 218980783 615530021 727607322 319915341 865252920 369122423 20518808 171718894 121422853 783862526 472703321 482...

output:

705175720438

result:

ok single line: '705175720438'

Test #47:

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

input:

4751 62
866728445 315834295 698525326 988538101 199512934 255307125 108989261 238205333 167426249 622688273 62071681 379179462 291328891 840116424 54654585 373206717 726233069 283851756 146029436 998558510 111574118 260982330 100253521 653195494 729671783 674379805 671442795 511566751 215820554 6404...

output:

17459406934

result:

ok single line: '17459406934'

Test #48:

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

input:

1 299541
873519995
402029761

output:

261655052822295

result:

ok single line: '261655052822295'

Test #49:

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

input:

15 19954
339468269 957579908 111013673 3475296 431448004 137161210 985766063 333784172 180938802 725186781 343090207 949885023 476472536 976183818 129846781
505353080 212053472 515951483 606342063 985838592 574320909 217934367 641286262 606420694 853566083 863598838 770796250 896906001 805126951 456...

output:

14050699260216

result:

ok single line: '14050699260216'

Test #50:

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

input:

98 3054
849984788 126073034 797948033 464424716 140302131 421888447 663988307 252959370 867234582 531049283 546747772 399896751 840187464 360207834 593154155 85088068 861446787 519724133 247410247 522490841 909632487 809937613 702895092 205318864 132683736 26970124 878836614 344378851 794384497 6163...

output:

1027780662402

result:

ok single line: '1027780662402'

Test #51:

score: 0
Accepted
time: 41ms
memory: 8004kb

input:

148624 2
682841446 842591094 183870928 913592553 371360317 716126188 921302422 67966115 962944475 788780885 922034327 538332342 87431430 252571301 95863981 533228123 516733699 102891718 488236457 468077541 553657173 471381973 709005683 717000461 972960012 195131447 999891251 680843786 801247857 5304...

output:

515918650

result:

ok single line: '515918650'

Test #52:

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

input:

100000 3
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

3000000000

result:

ok single line: '3000000000'

Test #53:

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

input:

100000 3
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 10000...

output:

3000000000

result:

ok single line: '3000000000'

Subtask #4:

score: 29
Accepted

Test #54:

score: 29
Accepted
time: 14ms
memory: 8136kb

input:

46277 26082660
216820392 975920171 670198908 751879346 785464410 137803695 990316039 136082781 508319725 285053836 962754829 189537126 843451157 603648162 288458523 785309345 169328756 469187125 338962865 683500991 389745945 300198265 425154931 243946562 947186175 802786983 215106495 843125200 25944...

output:

1649349400858800

result:

ok single line: '1649349400858800'

Test #55:

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

input:

134402 213977
354127362 466466705 264673839 368419003 19094918 120973266 657169678 31387949 167460016 560536543 919543850 716433626 529408125 215153655 28708914 776554269 178184187 878003153 561479796 213194915 941457004 613773927 613018619 792927384 300832847 142835848 577497599 866650846 274382245...

output:

18429048917344

result:

ok single line: '18429048917344'

Test #56:

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

input:

31415 92
289610992 141809603 98698877 190933093 464442187 601709540 823305042 348290927 693268976 150260735 593927123 993649671 725555511 599092249 902757838 756111591 477244253 993703487 38511569 132542400 234468185 182240498 460516548 822902455 18805813 762977631 383065323 111084668 114662882 7630...

output:

9952589196

result:

ok single line: '9952589196'

Test #57:

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

input:

300000 2
196402839 214076790 677992263 767896778 889226845 443127493 181437631 21410741 666189581 755959325 228176790 525043251 205398011 49793396 784234784 557422555 227101292 884542852 883078212 1594525 730250272 268921266 761858891 855259803 327118948 800050768 162527642 32500985 790893812 677501...

output:

4534160

result:

ok single line: '4534160'

Test #58:

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

input:

300000 3
880237150 129359832 148759871 326440360 600942425 696120545 820936063 647729805 7561787 854164087 720459196 79744884 995177687 99959740 219434332 824959822 475774863 171493467 199870369 198244697 999057258 874377108 978974991 606648508 658396318 648784180 277363933 894208565 398762431 23155...

output:

183800342

result:

ok single line: '183800342'

Test #59:

score: 0
Accepted
time: 60ms
memory: 8356kb

input:

300000 10
320634317 415791038 127763643 917805508 449839858 922198179 353588398 368793393 121407771 274235014 270866970 676240714 980200613 417990746 279287693 497194720 679250046 790815729 565442907 613487998 133134932 284767663 811995643 207521993 634100788 262289408 68253208 836141174 29058377 33...

output:

581943660

result:

ok single line: '581943660'

Test #60:

score: 0
Accepted
time: 72ms
memory: 8300kb

input:

300000 1000
964709204 519640713 518025767 697662003 79061126 580260125 959635874 560476724 131704405 513789044 391734656 923438882 63910155 965058046 207011248 365095660 313203934 178003811 106113551 959879903 165824776 381927460 887339372 568677467 100782486 759951168 559026885 705245307 659371145 ...

output:

81548196863

result:

ok single line: '81548196863'

Test #61:

score: 0
Accepted
time: 84ms
memory: 8352kb

input:

300000 1000000000
957093878 12695891 462363176 783394095 980326381 921960708 875420894 708624956 424399185 120415711 820517616 464024473 555529954 318137533 857958873 981068908 32416198 780436560 738371785 543302364 852678172 594280317 783664707 912238912 550415466 447803483 872191641 808296485 2503...

output:

31255144134529426

result:

ok single line: '31255144134529426'

Test #62:

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

input:

300000 1000000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1000000000

result:

ok single line: '1000000000'

Test #63:

score: 0
Accepted
time: 91ms
memory: 8416kb

input:

300000 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 1000000...

output:

1000000000000000000

result:

ok single line: '1000000000000000000'

Test #64:

score: 0
Accepted
time: 44ms
memory: 8368kb

input:

300000 1000000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1000003333

result:

ok single line: '1000003333'

Subtask #5:

score: 9
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #65:

score: 9
Accepted
time: 12ms
memory: 5980kb

input:

32355 10636309
658282320 339936472 791487914 698122390 22875961 51147612 179290430 69040146 171659807 114076986 779980849 513859774 7040237 486323806 572623576 302177800 474856563 988178280 931835647 253333 628388833 759589329 780901820 945561604 184772289 593805103 804424685 507953421 348083249 423...

output:

3428768655594944

result:

ok single line: '3428768655594944'

Test #66:

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

input:

7933 69274581
296049713 879620032 262406411 585705945 463308321 438800885 961234681 218473214 711971842 434816148 347557889 130031249 549508001 186038440 783604080 272496030 884128840 50299291 261728192 792494364 261101854 682709493 887753361 867506130 487145728 447899299 18990191 800414164 95661955...

output:

23591718714672344

result:

ok single line: '23591718714672344'

Test #67:

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

input:

54 406455238
249075027 292788234 641715429 902327572 949190245 230445170 943118163 628011649 826226167 547913748 367119430 421347342 647641981 533710649 83702746 771692501 409954104 461085397 962147737 139499109 569387961 615641471 761970035 324064575 570340643 652789366 686053496 574023746 12359748...

output:

235556573893697043

result:

ok single line: '235556573893697043'

Test #68:

score: 0
Accepted
time: 17ms
memory: 6064kb

input:

43069 317919118
238775720 584818604 958340344 925177157 312092908 427034941 918259653 284479283 532792704 119434140 251216412 799774652 136365830 877840357 355094215 183483102 929060363 491400280 844951199 586467492 690487233 898016198 160246262 371085573 554275898 889141451 480100438 207074781 2578...

output:

88999169945335530

result:

ok single line: '88999169945335530'

Test #69:

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

input:

9930 4868753
409932899 363490141 831186265 381561076 640632096 541188679 532153149 750921143 278681494 214145010 300456268 153097980 720530888 17447296 343210261 493101179 900175919 857347208 617545390 428565365 234870682 77591429 876950531 38420730 696198895 741313225 395168594 20239305 176191011 3...

output:

1556608695778514

result:

ok single line: '1556608695778514'

Test #70:

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

input:

876 19768357
13220921 297514785 64280939 629160018 254257370 929044438 627917205 351690424 809530780 905898425 253767877 204084401 372826574 216704292 965908811 969728095 199141813 48202617 906272246 629808738 143612186 436735501 628696173 589103969 380373692 343661763 34315210 624724753 611477637 2...

output:

6560869297149506

result:

ok single line: '6560869297149506'

Test #71:

score: 0
Accepted
time: 85ms
memory: 8364kb

input:

300000 4
601843885 909025896 630549408 201886796 504791308 593567716 802741159 344462457 975254953 126834505 61459616 604206726 680350793 135585493 65723205 793557356 331842857 326130794 141794966 838734771 612152304 147531068 122352607 239202942 670739383 673461759 923748327 7100582 298109851 19797...

output:

1089351296

result:

ok single line: '1089351296'

Test #72:

score: 0
Accepted
time: 92ms
memory: 8364kb

input:

300000 47
271460587 79551183 753407458 143987009 351837206 97214876 211848405 938621287 619556120 763404938 90497993 964254183 475123451 273624416 687409696 539002514 923865414 297902261 91323161 909438874 843307537 991463098 653089412 790343991 424351174 941764787 612248783 531987481 814277920 6433...

output:

14362516457

result:

ok single line: '14362516457'

Test #73:

score: 0
Accepted
time: 98ms
memory: 8312kb

input:

300000 370
205112664 162850461 2820224 714092567 546891861 858538909 84581426 630090448 158386574 692297432 593476479 769035325 356190288 773478175 865220107 754473009 341436205 444874210 521256076 279437030 920667431 65868934 619471769 90827261 282033485 868085731 543555165 209075922 617942222 8672...

output:

119044953440

result:

ok single line: '119044953440'

Test #74:

score: 0
Accepted
time: 110ms
memory: 8352kb

input:

300000 101409
74180919 303035435 2693488 264882357 468312097 426839144 4763132 556282277 386939560 110154304 570995563 914242791 628820086 536776510 1827979 845697564 130851382 218891503 675501993 350598144 897988863 504035756 819580407 258419379 349897762 359874133 46085516 656834504 365430451 5619...

output:

33382807598401

result:

ok single line: '33382807598401'

Test #75:

score: 0
Accepted
time: 122ms
memory: 8416kb

input:

300000 145209140
975130830 567262073 337318880 786696372 848594502 110829488 943375897 76613072 819045232 640748417 826355954 814031676 297887922 96930867 780956243 464939500 808642209 928832046 961127731 753651207 10323307 646725103 932724577 990669164 873593100 945738652 307874763 289668762 418114...

output:

44949215347048512

result:

ok single line: '44949215347048512'

Test #76:

score: 0
Accepted
time: 126ms
memory: 8368kb

input:

300000 1000000000
713635484 367354662 725243888 604081995 574849195 193891233 795385094 231661694 276833806 246017838 725533868 769040591 283468848 203969716 670392237 628209464 138635312 706115254 873358968 783632774 672049776 107158146 414537340 671082431 543401478 402035497 374912468 591434781 86...

output:

261735171296851343

result:

ok single line: '261735171296851343'

Test #77:

score: 0
Accepted
time: 79ms
memory: 8432kb

input:

300000 1000000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1000000000000000000

result:

ok single line: '1000000000000000000'

Test #78:

score: 0
Accepted
time: 80ms
memory: 8356kb

input:

300000 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 1000000...

output:

1000000000000000000

result:

ok single line: '1000000000000000000'

Test #79:

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

input:

9 1
4690932 895110306 820765894 677460989 391598298 193096548 390088929 823596663 638233179
4690932 895110306 820765894 677460989 391598298 193096548 390088929 823596663 638233179

output:

4690932

result:

ok single line: '4690932'

Test #80:

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

input:

300000 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1

result:

ok single line: '1'

Test #81:

score: 0
Accepted
time: 60ms
memory: 8376kb

input:

300000 1
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 10000...

output:

1000000000

result:

ok single line: '1000000000'

Test #82:

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

input:

300000 1
867322174 350107543 730655906 141399562 220034250 472454999 150166671 406486481 26798160 971337355 7979390 293848709 505341284 951351765 388385102 824148096 252911193 984043009 967907972 207921381 429096138 187507116 480763783 825045198 330188265 528449652 220765495 536804601 457028431 6514...

output:

3861

result:

ok single line: '3861'

Extra Test:

score: 0
Extra Test Passed