CT62021

Tailor's Ledger of registers

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The council of the gristmill of Rye Hollow pays by the answer, and Tailor 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: 983 785330977 938963739 926407817 218693194 558450304 676500820 855839829 990831128 103520536 459121585 994627106 504303135 555736633 28083605 940126111 793784617 107033461 974664055 549667062 882839387 932947686 812920437 552314317 409229871 375213274 907966191 761465086 904881010 323524069 385166436 341091298 632099095 476923657 93387121 152099495 3665268 45904039 630934454 411971309 238648377 100532325 443279136 888215637 283831524 528137116 327959252 786301034 979275293 965894690 833284579 403328251 107781238 609281255 861845575 684359017 124291991 277339374 592646167 680114674 802396819 298446718 253709995 984740905 858993870 838144251 188733913 109792374 278111311 911060873 350105026 277914663 279078252 974947693 885506791 739913461 276064801 143360916 408918883 768170499 69261038 63…
Output: 9121906341

Example 2:

Input: 633 240748883 685421257 891268606 549500431 944587113 740782111 919180362 799856699 557121687 182704846 401397542 592069028 596291238 192533747 130948232 81696927 109122427 697187861 142082122 886633736 946512667 373406971 11276752 526413088 962589802 535599966 246807893 580691039 505778836 621556469 84590841 493939505 352856759 24238368 594097831 606119600 32189879 487264650 392932239 547348240 763780665 745366382 811803237 887306497 661778173 525787565 103165317 2833642 223328605 64085028 923648925 861437742 586731462 421070524 309351849 712469111 648772044 943881386 799726767 37870974 412022586 466206556 198072224 636692601 262857890 988148934 241011260 996894174 89347001 844773235 304978025 54507060 701763734 296520322 610746920 428867720 832690897 183779645 702655982 789158694 3935200…
Output: 5831563550

Example 3:

Input: 914 495477099 317312400 882131702 267483668 332701110 154306057 271618093 725056281 669666880 606467955 661436567 864899598 946588594 798636092 351657631 359234583 95862314 35962332 870760164 463889178 254939083 959453090 370799326 729753906 835146759 232975012 143835409 259963209 147746082 508911826 379725085 358636983 167070149 511939019 4075853 605301285 584039030 169675176 587029362 112623863 370248638 775580805 389038212 994818658 443593741 152080671 489918303 731329526 438331941 904419163 369597010 253571915 106542056 808653983 251860890 120325052 114145403 961748761 346125566 450479766 72235998 474239648 423871740 426108926 486454977 94255884 546432154 518795821 226086323 800328172 143844454 677086598 548303884 352937658 510738571 710452080 535874886 381841014 281518511 189627587 47…
Output: 9473917332

Constraints:

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

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