CT30879

Nora's panels Fixed Window Peak

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The customs officer Nora has been asked to audit the season's records. On the desk lies a long table of panels readings. 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 <= 1143; 1 <= a[i] <= 1000000000.

Example 1:

Input: 599 376 211743288 689744392 7942750 44624802 289587120 919769341 626501675 171151082 497057015 507289114 402231129 755732598 443058276 34054457 806510925 757412753 806153453 459372344 370483139 66591740 522422322 667850497 348233241 833273111 291449216 875718466 61368322 900331372 474321363 856361278 271763492 406504808 369729385 149555543 682275900 142459042 488368763 270381421 172287274 661387677 938389822 757013966 49011086 692055065 799497480 317171229 128221244 367911129 636676464 603905872 665818998 646025948 365800336 101148564 357570694 43995110 426813337 295342511 902598926 479278037 680255222 55029475 283851213 844840094 527256261 309961460 261687838 898129860 542641251 593844873 510671574 888401217 804016032 108230718 882080579 50162061 597380869 754498581 999671748 950987888 79…
Output: 197149923588

Example 2:

Input: 380 316 232843024 150424872 240632155 524637650 728790724 428493934 91021654 702826569 76623774 424319288 471035960 166456896 506155586 297590619 801407237 18060153 56890055 721755994 963776352 840831975 175134041 528576296 363392441 416208898 855907665 36546106 251679602 175668761 540582492 648855921 757659427 183332245 433894605 928121394 499143695 47436732 750209844 677722439 86246289 528329820 774883403 880532260 418886139 639986681 409936104 206197997 806462106 806258964 527202387 133124653 986684279 551528090 846361170 312842163 845896005 740796621 415788665 687941770 368528432 287739090 744265551 228939206 435713272 191828779 441528432 762677190 695311683 536060194 2840419 870184750 874651596 136363474 329397743 839707005 715621287 333259789 773070633 285042472 3800725 842436205 898…
Output: 157531500415

Example 3:

Input: 957 386 72150573 425469116 810396079 526720059 355341544 842145955 700587597 757832005 571551081 871601308 986255530 929852250 472125668 12600514 307772608 841719840 438324954 591332508 673594958 964914119 961990533 915584426 371028974 1592735 425664808 541058490 149512032 675157053 386145232 613291035 287608066 265116903 806224378 792602952 324150662 831124001 504816527 562416712 137630560 725201668 233261068 367878396 9515861 181527406 700301709 466104762 369670052 380662369 380113587 431217996 163212672 220267267 262530304 628058222 724349423 154491531 292357436 571194382 190928395 748335300 655104140 916417599 161463456 35950177 955624348 77920227 258960300 164417318 63874718 721827041 658926423 404518506 821187239 664052237 72455003 856223100 467987019 65814648 951683194 303831869 132…
Output: 201805249944

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Nora's panels Fixed Window Peak - MEDIUM Coding Problem | CodeTikki