#C1941. Missile Silo Launch Waves

    ID: 45202 Type: Default 1000ms 256MiB

Missile Silo Launch Waves

Missile Silo Launch Waves

You are given n missile silos and a list of their launch times. Your task is to group the silos into waves such that no two silos in the same wave launch at the same time. The grouping should follow the order of the first occurrence of each unique launch time.

For example, if n = 5 and the launch times are 1 2 1 3 2, then the first silo launches at time 1, the second at time 2, the third also at time 1, the fourth at time 3, and the fifth at time 2. The waves formed are:

  • Wave 1: Silo 1 and Silo 3 (launch time 1)
  • Wave 2: Silo 2 and Silo 5 (launch time 2)
  • Wave 3: Silo 4 (launch time 3)

Your program should output each wave on a new line, with the silo indices separated by a space.

Note: The order of waves is determined by the order of first appearance of a launch time in the input list.

inputFormat

The first line contains an integer n representing the number of missile silos.

The second line contains n space-separated integers representing the launch times of the missiles from each silo.

outputFormat

Output the waves in order. Each wave is printed on a new line, and within each wave print the silo indices (1-indexed) separated by a space.

## sample
5
1 2 1 3 2
1 3

2 5 4

</p>