#C2977. Taco Score Challenge

    ID: 46352 Type: Default 1000ms 256MiB

Taco Score Challenge

Taco Score Challenge

In this problem, you are given the scores of n participants in a competition. Your task is to determine:

  • The identifier (1-indexed) of the participant with the highest score.
  • The identifier of the participant with the lowest score.
  • The difference between the highest and lowest scores.

If there are multiple occurrences of the highest or lowest score, choose the participant who appears first in the list.

The difference between scores is calculated as: $$\Delta = \max(score_i) - \min(score_i)$$.

You need to read input from stdin and write the result to stdout in the format specified below.

inputFormat

The input consists of two lines:

  1. The first line contains an integer n representing the number of participants.
  2. The second line contains n space-separated integers, where each integer represents the score of a participant. The scores can be negative.

outputFormat

Output a single line containing three space-separated integers:

  1. The identifier of the participant with the highest score.
  2. The identifier of the participant with the lowest score.
  3. The difference between the highest and lowest scores.
## sample
5
10 -5 3 7 -2
1 2 15