A11745 | Hyperspace Jump (easy)
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
The Rebel fleet is on the run. It consists of $m$ ships currently gathered around a single planet. Just a few seconds ago, the vastly more powerful Empire fleet has appeared in the same solar system, and the Rebels will need to escape into hyperspace. In order to spread the fleet, the captain of each ship has independently come up with the coordinate to which that ship will jump. In the obsolete navigation system used by the Rebels, this coordinate is given as the value of an arithmetic expression of the form .
To plan the future of the resistance movement, Princess Heidi needs to know, for each ship, how many ships are going to end up at the same coordinate after the jump. You are her only hope!
To plan the future of the resistance movement, Princess Heidi needs to know, for each ship, how many ships are going to end up at the same coordinate after the jump. You are her only hope!
输入格式
The first line of the input contains a single integer $m$ ( $1<=m<=200000$ ) – the number of ships. The next $m$ lines describe one jump coordinate each, given as an arithmetic expression. An expression has the form (a+b)/c. Namely, it consists of: an opening parenthesis (, a positive integer $a$ of up to two decimal digits, a plus sign +, a positive integer $b$ of up to two decimal digits, a closing parenthesis ), a slash /, and a positive integer $c$ of up to two decimal digits.
输出格式
Print a single line consisting of $m$ space-separated integers. The $i$ -th integer should be equal to the number of ships whose coordinate is equal to that of the $i$ -th ship (including the $i$ -th ship itself).
输入输出样例
输入 #1
4 (99+98)/97 (26+4)/10 (12+33)/15 (5+1)/7
输出 #1
1 2 2 1
In the sample testcase, the second and the third ship will both end up at the coordinate $3$ .
Note that this problem has only two versions – easy and hard.
Note that this problem has only two versions – easy and hard.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted