CT62176

Odin's marks Grand Facade

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The council of the coral atoll of Pearldeep pays by the answer, and Odin intends to earn it. First: the full register of marks. 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: 1121 597741205 249753639 76895114 134999923 400634586 64123744 204690694 489384954 109711937 872077409 739875632 456216669 25755447 353015324 600878772 244114071 300719267 176059746 467795759 428640177 903215186 5001198 131812478 278179213 969925885 267345599 459114363 454815000 283083765 560768630 970987390 291969606 106349051 663351131 751633784 792569205 154347567 346510612 274465488 688689833 259163631 153862291 219517201 866941138 102833753 148492346 558497778 500560408 746909535 729320926 733726883 970512797 458490444 471365563 914895495 280464324 156019460 255615174 636946923 286830696 568859760 662335704 165752469 326472607 606539360 488640045 485783938 864294880 711180181 874316663 424923915 638082181 372609155 428963652 691538681 352321971 804514854 380502676 444044478 362206651 …
Output: 7014452762

Example 2:

Input: 238 787453579 721977645 660784997 145535008 970492994 114164600 174562886 194173385 805945542 38899768 262404096 315635776 80483710 930123513 854968340 204021733 78944588 242798582 32877812 697758169 811284748 791369279 33021243 860351793 885814026 745150907 342467313 185892505 587932100 316117418 753379997 624741211 328102597 942361100 521927818 701156063 33451861 633104460 273366784 828583749 430109771 786129873 200071053 756525204 813042390 187538321 704010440 419648832 313183184 644138487 856537231 226763385 526050557 916481648 325612348 807256706 634847265 320024922 776546603 697071792 628235928 364504605 868454014 250862759 675988461 933334844 939535612 779349093 178803665 425731061 969325044 660313474 87801062 475473695 37720959 7497743 440084135 722666408 722855036 164387317 255929…
Output: 7038681619

Example 3:

Input: 3563 736043860 290363960 303301635 133869582 155150815 708452069 946904388 264083003 853004779 901206336 175220843 24575006 499264137 559629661 878632310 296173059 196499589 146163124 56827087 866197097 20984508 401150025 699056972 988244197 613999368 931031066 145480683 213487989 156062959 546451320 596991943 698957271 5670372 708767354 472616515 84760825 709451661 996754716 599956698 464429227 92139186 983627749 54190895 665863963 637733212 528213174 924600438 682595703 459925840 606292463 721521641 988321893 406565252 172747161 859423670 66913222 911575928 297336396 564273691 750839330 783557420 299460137 441575439 115511925 424142428 385861427 828511883 308898205 46341744 14490345 419159933 412182047 992727651 209205199 440986373 933288760 386055205 692451786 955320937 640083752 362796…
Output: 8532315819

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Odin's marks Grand Facade - MEDIUM Coding Problem | CodeTikki