CT26593

Tarun's First Peak Index Ledger

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Tarun found an old ledger of lanterns in the ropewalk attic at the lotus ponds of Tranquil Basin. The margin notes pose a precise question. Task: Read n integers and print the 1-based index of the first occurrence of the maximum value. Input format: First line: n. Second line: n space-separated integers. Output format: Print the 1-based index of the first maximum. Constraints: 1 <= n <= 646; -1000000 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 481 -855251 -44628 -431324 -723865 -972933 -491785 -637764 -615676 -538053 -700288 -349142 -402578 -302201 -560133 -247811 -350009 -596766 -516085 -80546 -894569 -785964 -698815 -10292 -796451 -811480 -694977 -758936 -844999 -860935 -507895 -960132 -228163 -423094 -352137 -385430 -402486 -582716 -824377 -600004 -891582 -83658 -239421 -444982 -471496 -790234 -686067 -265871 -782336 -679440 -513725 -880962 -558033 -452901 -420758 -745944 -371257 -100813 -578490 -889184 -723091 -362493 -160701 -230291 -476856 -354478 -330776 -367651 -341883 -871448 -750701 -776964 -800466 -944959 -344672 -452661 -723020 -197006 -850203 -9030 -21748 -135037 -137929 -60411 -9854 -903472 -416924 -756840 -415732 -954194 -189221 -2396 -574610 -725802 -910311 -608542 -482642 -291425 -354078 -165294 -241467 -707827 -537636 -201491 -325868 -807860 -876709 -439581 -147178 -802454 -329474 -60160 -189772 -800370 -582661 -609423 -930480 -974470 -989986 -777094 -120439 -223102 -767193 -881894 -875078 -199811 -591298 -331339 -756236 -94166 -875890 -327436 -835583 -256278 -736084 -177820 -444456 -165826 -924784 -913601 -473763 -452507 -724881 -441423 -873690 -387516 -789565 -653519 -302492 -386600 -455699 -384384 -626400 -884548 -279985 -616592 -582884 -452195 -572381 -468443 -355735 -498075 -5680 -922293 -634707 -205231 -874667 -900046 -768486 -644684 -97945 -681999 -927617 -266823 -31454 -996451 -442558 -675982 -686815 -805828 -21239 -621241 -287628 -204974 -240391 -372864 -888023 -326932 -718333 -991206 -435114 -44968 -66516 -320782 -239205 -936226 -984678 -371952 -381658 -664374 -428694 -674217 -59446 -871885 -932080 -940091 -58375 -813846 -34611 -945172 -691527 -738260 -215955 -500692 -360323 -439750 -591313 -272493 -174038 -972279 -729743 -27173 -113337 -901751 -28709 -75039 -525668 -55875 -788731 -961831 644 -669892 -157567 -343754 -571423 -894017 -864699 -106327 -433289 -498142 -773805 -964733 -420489 -455481 -936935 -811174 -180957 -943775 -335316 -822675 -695205 -623558 -132145 -238007 -984817 -984126 -209157 -684346 -156789 -739838 -7784 -67667 -79942 -307960 -433250 -741264 -559204 -330482 -397853 -762215 -431435 -503847 -873439 -823827 -366602 -33263 -276120 -939769 -757852 -639558 -141867 -421486 -632942 -607255 -467981 -897271 -187072 -631570 -511986 -492889 -806906 -561385 -260435 -690479 -814330 -536675 -226891 -523172 -391880 -782213 -687843 -504780 -767534 -90679 -313915 -96308 -999606 -521801 -135367 -528082 -195639 -460373 -626393 -737969 -589427 -882673 -673618 -931429 -459734 -149741 -419585 -78656 -60029 -890863 -272052 -794056 -423454 -549193 -244345 -568672 -880648 -762377 -312862 -497662 -693198 -194095 -528086 -178631 -277079 -421645 -106657 -106873 -927123 -776148 -511963 -569137 -669898 -265567 -49742 -83156 -505311 -956451 -686095 -475042 -352405 -790943 -875835 -926998 -331520 -649425 -951915 -430543 -208223 -327077 -108018 -785387 -759975 -914621 -976226 -122862 -833204 -485744 -348288 -830385 -561702 -722787 -379518 -700489 -268215 -607620 -873887 -340921 -35700 -137997 -915219 -74912 -980676 -326026 -526881 -95744 -559313 -266269 -816964 -888654 -817874 -703665 -105345 -858147 -38878 -659006 -703088 -893981 -328103 -200145 -553370 -331556 -727426 -91809 -108360 -18816 -6245 -489107 -403793 -357283 -786599 -803773 -639177 -889766 -342436 -909762 -587698 -463978 -236642 -761793 -590214 -450698 -139734 -15683 -88816 -354973 -744194 -105545 -197139 -417579 -828301 -232183 -102009 -161498 -450394 -81554 -252511 -724419 -932036 -876507 -5386 -282742 -725833 -898 -731074 -572491 -398699 -304623 -837513 -501890 -259665 -223945 -702549 -650031 -320803 -722821 -411017 -756866 -564889 -892241 -395420 -43017 -955573 -724940 -629767 -805304 -989646 -983575 -196727 -606725 -431466 -872334 -579505 -190470 -995993 -843008 -935231 -488777
Output: 230

Example 2:

Input: 120 -684032 -750314 -134551 -943661 -841303 -17731 -197107 -646348 -512013 -982912 -400012 -649623 -612029 -591492 -428407 -874287 -270902 -372202 -533009 -530040 -881836 -612296 -41676 -368772 -898795 -450458 -692105 -280007 -959455 -438390 -447275 -626831 -82421 -268473 -481278 -735492 -351203 -763739 -826079 -934613 -890526 -318776 -318402 -163438 -366986 -148729 -770511 -123728 -129052 -833069 -106409 -875682 -892582 -2001 -56936 -553145 -944359 -873874 -783573 -860783 -691933 -700442 -304962 -12311 -279357 -49384 -738058 -107387 -331893 -228099 -325379 -339647 -64555 -254505 -99508 -163775 -358293 -378515 -767698 -437646 -161019 -708690 -349175 -728143 -57370 -323786 -937878 -909398 -935653 -412371 -665035 -443779 -790082 -38679 -292481 -803402 -344738 -387747 -929503 -810129 -754501 -815424 -721299 -103943 -964964 -231188 -683911 -528156 -946282 -183102 -623875 -343421 -394466 -548796 -778038 -789839 -720697 -893581 -782509 -817575
Output: 54

Example 3:

Input: 107 -693079 -382401 -281725 -283968 -440361 -598712 -473303 -579772 -179107 -797032 -80692 -877927 -128677 -785499 -62423 -394626 -936119 -156661 -557575 -992484 -213566 -602566 -848328 -197738 -777243 -190899 -658740 -95013 -699078 -16650 -60152 -305654 -986624 -267525 -254603 -789643 -373771 -466920 -542133 -74800 -492204 -302210 -713222 -940817 -174340 -124586 -813291 -440915 -434398 -851818 -126994 -296701 -191001 -882095 -502291 -987360 -392362 -37580 -661758 129 -105924 -249296 -438472 -78631 -140397 -681181 -478070 -888957 -981091 -616164 -287516 -129536 -848673 -595472 -775144 -786662 -630285 -247052 -837705 -243100 -403710 -748326 -380240 -405025 -383475 -678113 -69241 -502853 -462240 -167722 -240328 -724312 -43876 -898637 -99248 -364876 -333678 -722634 -701867 -347758 -141725 -542296 -842943 -186115 -57460 -69933 -599411
Output: 60

Constraints:

1 <= n <= 646; -1000000 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Loading...
Test Cases:No test cases
No test cases available.
Tarun's First Peak Index Ledger - EASY Coding Problem | CodeTikki