CT61983

The Bronze registers of Boris

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The council of the herring shoals of Silverfin pays by the answer, and Boris intends to earn it. First: the full register of registers. Task: Bars of heights h[i] stand side by side with width 1. Print the largest rectangle area that fits inside the histogram. Input format: First line: n. Second line: n heights. Output format: Print the maximum area (fits 64-bit). Constraints: 1 <= n <= 4000; 0 <= h[i] <= 10^9.

Example 1:

Input: 3614 911239908 614742865 92774115 990631069 471199157 256766177 825533241 8519714 712385337 176884758 389200756 554233093 795858979 498754683 823226969 587526979 484439706 452839140 636325018 390836643 116598218 133237928 414275448 824460526 319219097 514883594 518023346 455086378 657051072 767772521 746757430 472009584 77592234 656521923 507435429 690377965 380845267 467440472 887402056 590608507 734089746 384313 585235996 662992606 976710047 910358078 132199226 680840510 538845761 403861045 529297212 47187636 738567766 161161078 99542024 709074111 229676558 806775281 830658331 667621265 779275380 421725116 998366461 609102451 871319156 114478432 434660368 593533507 606356659 46976759 278923892 995410212 367448239 189906688 14905540 102581110 132776922 143860017 210745252 829893200 747997…
Output: 7303689280

Example 2:

Input: 95 141627959 569885772 944308882 938416184 697313762 634210568 467163567 864735696 644432006 597244559 76234519 249588866 850204980 143244308 912507460 11584547 288973328 238305709 650117001 234508036 416021374 290205917 609791176 701360164 513519557 29856750 803817949 899363658 794804147 955356820 714443136 311160211 693623031 832690403 454254643 50264402 374947373 496924333 41543274 710915212 429637489 206131169 570671740 82361774 468874318 881028621 846822882 891360030 232962995 449236415 186393857 591776626 909881666 819047966 267522443 688134721 874899637 358867061 76088648 886080757 156843594 533052371 625628257 461333259 418478690 493633574 448304702 378047838 634382381 636791714 12430601 868789241 980756149 493198650 609738569 303167224 238582903 101920793 663110874 522315935 78057…
Output: 4204472103

Example 3:

Input: 2628 992240389 937658069 505341403 14164080 692071174 521011409 977096655 717503473 322972458 799827258 731842673 131030051 697418134 114680507 643845987 241359970 300845640 76686810 670443458 354246453 469266458 376680610 629859575 679667990 432110563 388901571 488391286 689173668 221275733 740746814 913932115 579168465 171641436 220389269 438332980 673856984 951177146 962294447 191432591 841534567 666746012 104878372 636747280 142487811 499893538 330396666 117451248 515484974 832401514 97303608 39424119 963118657 476406310 515028931 389847137 406068896 13409715 731474640 108906425 906812873 786905982 727884835 173107694 747781422 215820374 242101969 188298786 484117792 842748876 816414665 197095949 324152159 24888231 877014139 156002062 768032955 333120394 61679713 126173932 241016511 72…
Output: 8592481600

Constraints:

1 <= n <= 4000; 0 <= h[i] <= 10^9.

Loading...
Test Cases:No test cases
No test cases available.