A9914 | GukiZ and Contest
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Professor GukiZ likes programming contests. He especially likes to rate his students on the contests he prepares. Now, he has decided to prepare a new contest.
In total, $n$ students will attend, and before the start, every one of them has some positive integer rating. Students are indexed from $1$ to $n$ . Let's denote the rating of $i$ -th student as $a_{i}$ . After the contest ends, every student will end up with some positive integer position. GukiZ expects that his students will take places according to their ratings.
He thinks that each student will take place equal to . In particular, if student $A$ has rating strictly lower then student $B$ , $A$ will get the strictly better position than $B$ , and if two students have equal ratings, they will share the same position.
GukiZ would like you to reconstruct the results by following his expectations. Help him and determine the position after the end of the contest for each of his students if everything goes as expected.
In total, $n$ students will attend, and before the start, every one of them has some positive integer rating. Students are indexed from $1$ to $n$ . Let's denote the rating of $i$ -th student as $a_{i}$ . After the contest ends, every student will end up with some positive integer position. GukiZ expects that his students will take places according to their ratings.
He thinks that each student will take place equal to . In particular, if student $A$ has rating strictly lower then student $B$ , $A$ will get the strictly better position than $B$ , and if two students have equal ratings, they will share the same position.
GukiZ would like you to reconstruct the results by following his expectations. Help him and determine the position after the end of the contest for each of his students if everything goes as expected.
输入格式
The first line contains integer $n$ ( $1<=n<=2000$ ), number of GukiZ's students.
The second line contains $n$ numbers $a_{1},a_{2},...\ a_{n}$ ( $1<=a_{i}<=2000$ ) where $a_{i}$ is the rating of $i$ -th student ( $1<=i<=n$ ).
The second line contains $n$ numbers $a_{1},a_{2},...\ a_{n}$ ( $1<=a_{i}<=2000$ ) where $a_{i}$ is the rating of $i$ -th student ( $1<=i<=n$ ).
输出格式
In a single line, print the position after the end of the contest for each of $n$ students in the same order as they appear in the input.
输入输出样例
输入 #1
3 1 3 3
输出 #1
3 1 1
输入 #2
1 1
输出 #2
1
输入 #3
5 3 5 3 4 5
输出 #3
4 1 4 3 1
In the first sample, students $2$ and $3$ are positioned first (there is no other student with higher rating), and student $1$ is positioned third since there are two students with higher rating.
In the second sample, first student is the only one on the contest.
In the third sample, students $2$ and $5$ share the first position with highest rating, student $4$ is next with third position, and students $1$ and $3$ are the last sharing fourth position.
In the second sample, first student is the only one on the contest.
In the third sample, students $2$ and $5$ share the first position with highest rating, student $4$ is next with third position, and students $1$ and $3$ are the last sharing fourth position.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted