CT62007

Ulrica's signals Grand Facade

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The council of the singing sands of Echo Dunes pays by the answer, and Ulrica intends to earn it. First: the full register of signals. 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: 1881 154176288 992304794 872308500 406045679 685549350 373947588 701646397 2002802 43588690 617505685 407925060 111768836 912819965 964314197 933576374 647017611 783863729 969857290 868955071 126945068 388146468 581835377 320728063 117857725 807568961 990802346 800830882 341356437 298463926 212032380 901841361 533658604 631643397 845459932 907802441 949980965 937139263 866160340 124344997 17297945 416666086 734463077 102520802 346912258 698847139 134696667 735313550 973864204 887148731 176703459 239143209 418220759 446368693 756067718 95698710 461639648 180141964 42339255 174998762 389228875 257552526 745244799 662796129 856886377 734797256 332801488 572383700 891024757 747865205 492782711 6594311 85153356 882562886 244790880 674493200 910924410 981236929 276590598 277510890 783970480 4119…
Output: 5973429060

Example 2:

Input: 971 849696935 407520168 999336541 709550005 690347878 4258176 825290915 616584853 19794025 911455132 898861258 50567034 577399123 802854835 19798630 737511669 258272609 962296389 281736980 840145259 15693404 399575179 178991674 309522467 425138610 296872163 674894967 813672170 561873508 267889994 696393988 878179869 915080688 233441863 136405591 859610138 583456646 727736058 624970741 218410475 876731756 500455072 477212332 690348960 739566207 332362934 997006283 729949739 308020600 774782697 306897669 867942620 545642540 485164674 863778242 943229676 162906462 408153491 593548369 478340125 514835061 766724397 719700795 886748806 329177824 416516392 550668832 927066575 631396101 722371167 533818165 925148779 633837905 270395350 285722850 842359044 930124728 366329767 161722439 855288953 57…
Output: 8593552233

Example 3:

Input: 3411 565810367 398135548 251421280 701899965 716670101 367177818 72954751 395685646 967531882 200934293 308688831 949643621 300672266 155177742 626502409 151903162 117981770 237132147 872202369 447290367 191896963 543025162 349095556 929101572 796219519 147236765 57502664 802333348 980777809 693221521 638024598 584038000 211715356 698513465 995280569 856377925 736900561 412966577 747847565 180616880 803944705 726161031 530025956 583376571 749200268 462677823 465327266 472074908 773511142 338313120 276349434 913275897 447995840 236204454 370258193 740617224 566991210 934598404 508287971 226513431 809697170 303838047 458515111 158296148 240541162 141059030 184629961 245509903 641843184 854865120 673590197 413834732 631075425 548681257 231356182 448563371 832280934 129210031 856541052 7379826…
Output: 8043290640

Constraints:

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

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