305052: CF958D1. Hyperspace Jump (easy)

Memory Limit:256 MB Time Limit:5 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Hyperspace Jump (easy)

题意翻译

义军舰队正在逃亡!义军舰队由目前聚集在一个行星周围的 m 艘船组成。 就在几秒钟前,强大得多的帝国舰队追击叛军舰队到了同一个恒星系,义军需要逃到超空间。 为了分散舰队,每艘船的船长都各自提出了该船将要跳到的坐标。 在义军使用的老旧的导航系统中,该坐标是一个形如 $\frac{a + b}{c}$ 的表达式的值。 为了义军的未来,海蒂公主需要知道,对于每艘船,在跳跃后将有多少艘船与这艘船到达同一坐标。 你是她唯一的希望! 形式化地说,输入若干个形如 $\frac{a + b}{c}$ 的表达式,对于每个表达式,输出有多少个式的值与其相等。

题目描述

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 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF958D1/d69a7d7c3c678bb5c53aa5b1c81de4c6ffbba379.png). 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.

Input

题意翻译

义军舰队正在逃亡!义军舰队由目前聚集在一个行星周围的 m 艘船组成。 就在几秒钟前,强大得多的帝国舰队追击叛军舰队到了同一个恒星系,义军需要逃到超空间。 为了分散舰队,每艘船的船长都各自提出了该船将要跳到的坐标。 在义军使用的老旧的导航系统中,该坐标是一个形如 $\frac{a + b}{c}$ 的表达式的值。 为了义军的未来,海蒂公主需要知道,对于每艘船,在跳跃后将有多少艘船与这艘船到达同一坐标。 你是她唯一的希望! 形式化地说,输入若干个形如 $\frac{a + b}{c}$ 的表达式,对于每个表达式,输出有多少个式的值与其相等。

加入题单

算法标签: