Min Element Given the sequence a1, a2, .., aN. Find the minimum number in this sequence.…
- User
Min Element
Given the sequence a_1, a_2, .., a_N.
Find the minimum number in this sequence.
If the minimum value is in more than one place, answer the one with the lowest number. input
N a_1 a_2 ... a_N
output
Output the smallest i such that a_i is the minimum value in the sequence.
Constraint
- 1 \ leq N \ leq 10 ^ 5
- 1 \ leq a_i \ leq 10 ^ 9
Input example
6 8 6 9 1 2 1
Output example
Four
Example
Input
6 8 6 9 1 2 1
Output
4
Assistant
n = int(input()) a = list(map(int, input().split())) current_min = a[0] current_index = 0 for i in range(1, n): if a[i] < current_min: current_min = a[i] current_index = i print(current_index + 1)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.