

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
から までの番号が付けられた 人の人がとあるコンテストに参加し、人 の 得点 は でした。
このコンテストでは、以下の手順によって 人それぞれの 順位 が定まります。
- 変数 を用意し、 と初期化する。最初、 人の順位はすべて未確定である。
- 人全員の順位が確定するまで以下の操作を繰り返す。
- 順位が未確定である人の中での得点の最大値を とし、得点が である人の数を とおく。得点が である 人すべての順位を 位と確定させたのち、 に を足す。
人それぞれの順位を出力してください。
制約
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
出力
行出力せよ。 行目には、人 の順位を整数として出力せよ。
入力例 1Copy
4 3 12 9 9
出力例 1Copy
4 1 2 2
以下のようにして 人それぞれの順位が定まります。
- 変数 を用意し、 と初期化する。最初、 人の順位はすべて未確定である。
- 現時点で順位が未確定なのは人 であり、その中での得点の最大値は である。よって、人 の順位を 位と確定させたのち、 に を足して とする。
- 現時点で順位が未確定なのは人 であり、その中での得点の最大値は である。よって、人 の順位を 位と確定させたのち、 に を足して とする。
- 現時点で順位が未確定なのは人 であり、その中での得点の最大値は である。よって、人 の順位を 位と確定させたのち、 に を足して とする。
- 人全員の順位が確定したため、手順を終了する。
入力例 2Copy
3 3 9 6
出力例 2Copy
3 1 2
入力例 3Copy
4 100 100 100 100
出力例 3Copy
1 1 1 1
入力例 4Copy
8 87 87 87 88 41 38 41 38
出力例 4Copy
2 2 2 1 5 7 5 7
Score : points
Problem Statement
people labeled from to participated in a certain contest. The score of person () was .
In this contest, the rank of each of the people is determined by the following procedure:
- Prepare a variable , and initialize . Initially, the ranks of the people are all undetermined.
- Repeat the following operation until the ranks of all people are determined:
- Let be the maximum score among the people whose ranks are currently undetermined, and let be the number of people whose score is . Determine the rank of those people with score to be , and then add to .
Print the rank of each of the people.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line () should contain the rank of person as an integer.
Sample Input 1Copy
4 3 12 9 9
Sample Output 1Copy
4 1 2 2
The ranks of the people are determined as follows:
- Prepare a variable and initialize . At first, the ranks of all people are undetermined.
- Currently, persons have undetermined ranks. The maximum score among them is . Therefore, determine the rank of person to be , and then add to , making .
- Currently, persons have undetermined ranks. The maximum score among them is . Therefore, determine the ranks of persons and to be , and then add to , making .
- Currently, person has an undetermined rank. The maximum score among them is . Therefore, determine the rank of person to be , and then add to , making .
- The ranks of all people are now determined, so the process ends.
Sample Input 2Copy
3 3 9 6
Sample Output 2Copy
3 1 2
Sample Input 3Copy
4 100 100 100 100
Sample Output 3Copy
1 1 1 1
Sample Input 4Copy
8 87 87 87 88 41 38 41 38
Sample Output 4Copy
2 2 2 1 5 7 5 7