CT888

Neel and the First Peak Index

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Neel inherited the apiary at the savanna camp of Amberplain along with its curious bookkeeping system for lanterns. Time to make sense of it. 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 <= 65; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 44 886899 -900091 -931758 659454 259417 -933412 -181321 -689830 -974604 79485 -661684 -246433 -390297 -225266 96766 -990588 -171341 -566886 -237555 284559 648457 -794693 -553578 351283 118747 677650 -833223 197337 -204697 780410 534652 275358 -768508 776168 -746799 -404470 -663905 782408 857625 849041 -579774 -614332 174446 380955
Output: 1

Example 2:

Input: 15 29395 -204196 -640159 -728415 133845 753420 688820 549583 237140 -642813 -127103 -457866 216396 -569291 186144
Output: 6

Example 3:

Input: 35 -826832 -634870 417761 -532817 -914548 -556843 782665 -673753 602687 763679 332344 -283568 -297716 -720306 -925536 -478462 698947 468348 605870 -960381 880631 -105758 483431 -174914 781390 236248 -309733 -934316 955468 -468300 -310671 -713808 361675 829664 -706272
Output: 29

Constraints:

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

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