CF958D1.Hyperspace Jump (easy)

普及/提高-

通过率:0%

时间限制:5.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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!

反抗军舰队正在逃亡。舰队由 mm 艘飞船组成,目前全部聚集在一颗行星附近。几秒钟前,实力远超反抗军的帝国舰队突然出现在同一恒星系中,反抗军必须立即跃迁进入超空间。为分散舰队,每艘飞船的舰长各自独立决定了一处跃迁坐标。反抗军所使用的过时导航系统将该坐标表示为如下形式的算术表达式的值:
。

为规划抵抗运动的未来,海蒂公主需要知道:对每艘飞船而言,跃迁后有多少艘飞船将抵达同一坐标。你,是她唯一的希望!

输入格式

The first line of the input contains a single integer m (1 ≤ m ≤ 200 000) – 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.

输入的第一行包含一个整数 mm(1 ≤ m ≤ 200 0001 ≤ m ≤ 200 000),表示飞船的数量。接下来的 mm 行每行描述一个跳跃坐标,以算术表达式形式给出。每个表达式的格式为 (a+b)/c(a+b)/c,即:一个左括号 (,一个最多两位十进制数字的正整数 aa,一个加号 +,一个最多两位十进制数字的正整数 bb,一个右括号 ),一个斜杠 /,以及一个最多两位十进制数字的正整数 cc。

输出格式

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).

输出一行,包含 m 个以空格分隔的整数。其中第 i 个整数应等于坐标与第 i 艘船相同的船的数量(包括第 i 艘船本身)。

输入输出样例

  • 输入#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.

在样例测试用例中,第二艘和第三艘船最终都将到达坐标 3。

注意:本题仅有两个版本——简单版和困难版。

输入解题思路,AI测评打分。不知道怎么写?

首页