CT59017

The Grand Facade at Argentium

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Deep in the marble forum of Argentium, Iker studies rows of beacons entries. One clean number will settle the guild's oldest argument. 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: 2378 304076421 651798671 44158590 474743535 547496394 244972292 517467090 856609046 394572585 329787279 622610536 891430853 486412371 772921242 469077199 825826746 678006669 907812962 966866809 746504650 69749774 383499582 930294903 74253859 203648922 419701351 771938139 393310341 165635166 195804814 36309816 566756911 983489332 597132303 750645104 822536063 488266940 567493683 396811518 4413122 58236244 820477485 838831045 870169442 747150504 114360212 856138738 99061132 814047590 184858174 768623868 838553203 593479393 653889055 632156154 18070982 644431212 128485377 6538677 957027278 505789395 796036881 449656854 447959981 323714910 973931394 625391893 362042108 8782694 505461226 419708271 955636123 573556081 791583019 458030078 640679139 814761435 758711088 609109737 979761735 40978582…
Output: 8214286389

Example 2:

Input: 1785 729089000 926406148 537520903 148695651 843183183 187456414 846934378 200907524 183114301 873860319 328511599 191422079 398735664 154655105 367447093 282389287 582339969 886352807 316275347 129630632 203626148 476480948 929640267 78037590 876971260 706772678 694051791 823470167 699601474 624115335 364513832 45932726 642443844 513441195 505659439 730198150 312280841 905293405 505790757 160390052 868006375 672367400 547036552 113968144 881820253 917809008 989038097 180755787 741163767 390814354 419444557 890914659 135038535 216516712 109727423 629836376 502180179 973307011 814073144 127671830 249846740 217280601 400141614 383299424 326656730 788512663 14742757 9084481 723423291 841225590 846274077 786635088 228609595 673422378 198215571 845516838 210331209 951729059 687117382 220351836 …
Output: 8721127206

Example 3:

Input: 1077 479564887 994638486 418540205 370155476 998338976 667140128 704072006 445626281 243746000 566353049 583008517 380740074 940636555 492845142 69520554 976934896 715213544 108532731 333047824 602645534 995634924 737961276 663212668 47683775 746033396 778229299 977057600 952755453 36669005 370441428 397954901 898016768 158114827 314762716 830761050 698052631 199526856 812580848 698224261 241173477 357682906 57009368 761062031 652343785 30809094 829740526 206540709 324740120 560127243 584409945 480278735 271696776 45716617 525550141 368479699 762661251 703802636 334917263 418223098 441856688 271532630 48911246 956773975 736978492 926163519 653905119 515281469 851069394 200409470 176096229 844731153 879181407 803062046 787438524 768549068 719239501 188006831 464519589 102845778 252432815 37…
Output: 7992901361

Constraints:

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

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