PDP-23 (2011) -Phase B' Junior High School (snow_run)

View as PDF

Submit solution

Points: 15 (partial)
Time limit: 5.0s
Memory limit: 64M

Author:
Problem types
Allowed languages
C, C++, Java, Pascal, Python

Skiing at "Three - Five Springs"

Greece, besides being a famous summer destination, is also a place for winter tourism. Snow-covered mountains, wild rivers, and a continuous change of scenery can satisfy every related expectation. Our country boasts 16 ski resorts, some of which, like the ski resort at "3 - 5 Springs" (Vermio Imathia), offer entertainment all year round. The center features artificial snowfall and the downhill slope from 2005 m to 1430 m. On this large slope amid the fir trees, the speed contest's finals are held with individual timing. Each skier descends the course, and based on their time, the electronic boards display their position in the overall ranking. The first, for example, will inevitably have position 1. The second, 1 or 2, and the Nth any position from 1 to N.

Problem:

Develop a program in one of the IOI languages that, after reading the position of each skier in the overall ranking up to that moment, calculates the final position of each skier after the end of the race.

Input Files:

The input files named snow_run.in are text files with the following structure: The first line contains an integer N, the number of skiers participating in the race (10 \le N \le 40.000). The next N lines each contain an integer, the position in the overall ranking the respective skier has up to that moment.

Output Files:

The output files named snow_run.out are text files with the following structure: They have N lines, one for each skier. Each line contains exactly one number, the position the respective skier has in the final ranking.

Examples of Input - Output Files:
1st

STDIN (snow_run.in)

10
1
1
1
1
1
1
1
1
1
1

STDOUT (snow_run.out)

10
9
8
7
6
5
4
3
2
1
2nd

STDIN (snow_run.in)

10
1
2
3
4
5
6
7
8
9
10

STDOUT (snow_run.out)

1
2
3
4
5
6
7
8
9
10
3d

STDIN (snow_run.in)

10
1
2
3
4
5
5
4
3
2
1

STDOUT (snow_run.out)

2
4
6
8
10
9
7
5
3
1
Notes:
  1. There are no skiers with the same time.
  2. All lines terminate with a newline character.
  3. Maximum execution time: 5 sec.
  4. Maximum available memory: 64MB.
  5. The committee, in addition to the 10 main files with a size \le 10.000, can use (for additional scoring) in case of a tie, two additional files with a size \le 100.000.

Comments

There are no comments at the moment.