CT56033

Owen's windows Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the obsidian flows of Blackglass with crates of windows, and Owen the factor must account for every last one. Task: Print the maximum sum of any contiguous subarray of length exactly k. Input format: First line: n and k. Second line: n integers. Output format: Print the maximum window sum. Constraints: 1 <= k <= n <= 1798; 0 <= a[i] <= 1000000000.

Example 1:

Input: 384 257 292928029 389332906 213299547 103909255 969035951 979031383 678455936 579509694 871525850 320615809 43510499 323302459 741942364 876729363 615335048 534444344 197038084 220212808 129758643 21607097 475693886 583691091 87334525 351056072 388229480 447451909 381107350 490236264 444240252 688369942 979449573 450950558 820825259 217964010 481257887 678090934 921849512 858378302 894823794 642303083 310376672 117180087 586145426 770283821 867721926 954534145 850571606 72387529 207931674 799891568 226263995 476555623 972971587 939623928 380349202 511629405 228365934 562739079 587080717 690132717 527650827 969771744 893622391 491132899 557341827 862246110 896382441 833676283 288730702 146481028 466716377 399649050 94077789 463184614 770215513 3944820 335587443 606122640 570382662 379686010…
Output: 136299859295

Example 2:

Input: 127 80 270156872 177929031 55541242 228265586 778877013 773687411 120025163 931033386 520733235 939370858 54829199 292258706 325728359 64849380 67249209 369424665 408846998 200154585 536279464 335328387 379964377 576703495 24548234 193130017 342093633 956144152 367999344 81958594 890282535 312677161 494979711 711525451 322506685 990125317 335526863 224555668 324870113 890299680 552793760 892055337 429953827 572021891 286619739 686487830 574874278 525577864 257725642 525844144 488205641 947262318 234889474 229339984 646538116 146320008 391421848 75835155 782994988 62931671 774023179 921092129 211042872 642332081 465335974 705996126 148841413 675342338 607207144 169632578 853051924 316046353 207187785 622570314 536786716 266383088 243245308 128896711 436642389 377257861 911452252 865968116 1…
Output: 40286782154

Example 3:

Input: 772 66 390278828 385975902 586615053 393420279 854531578 284763312 381064374 201614606 748839553 680290014 286830931 257344885 602024719 627493750 209724880 652845673 792997697 161446275 999930011 762142065 975507898 618079184 614494863 37158711 933184913 176882326 874430677 585081692 260422380 718250224 201541295 208557443 367067155 751751751 731626383 40159500 858775771 522274393 363495352 232481526 511661704 299563470 589355030 670813703 995049038 494263914 119797590 928914831 407728820 171846729 883463946 974364018 260835489 58564214 762460642 715020933 222819934 948304750 450748411 211600866 761142769 140567216 77627666 335388366 973778442 695455755 817175608 49305171 686541356 32878854 787578388 436659743 606410939 937521852 730200077 616304875 350667505 556350429 41973278 551019720 …
Output: 36946406070

Constraints:

1 <= k <= n <= 1798; 0 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
Owen's windows Reckoning - MEDIUM Coding Problem | CodeTikki