問題一覧 > 通常問題

No.2153 How Many Coders of Each Color?

レベル : / AI推定難易度 : 124 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 266
作問者 : hibit_at / テスター : kotamanegi KowerKoint2010 Michirakara mo124121 ypww
お気に入りにしたユーザー ProblemId : 8537 / 自分の提出
問題文最終更新日: 2022-12-03 09:09:05
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 371 (Asakatsu Presents) (順位表) の他の問題:

Problem Statement

On the Discord server "Asakatsu", when a person declares a color, the declarer gets colored with that color (by hibit, through warm, heartfelt manual labor).

A person colored with color $C$ in this way is called a "$C$ coder".

As input, you are given $N$ declarations (the declarer's name $S_i$ and the color $C_i$) in chronological order. Answer how many coders of each color there are.

If the same declarer makes multiple declarations, the newer declaration (the one made later) takes priority.

Also, there are no $2$ or more declarers with the same name.

We would like to say that the colors are, from lowest to highest, gray,brown,green..., but the problem setter does not like imposing such implementation unrelated to the logic, so for simplicity, here there are $8$ colors $0,1,...,7$ from lowest to highest.

Input

$N \\
    S_1\ C_1 \\
    S_2\ C_2 \\
    \vdots \\
    S_{N}\ C_{N}$ 

  • $N$ is an integer $(1 \leq N \leq 2 \cdot 10^3)$
  • $S_i$ is a string representing the declarer's name $(1 \leq |S_i| \leq 2 \cdot 10^2)$
  • $S_i$ consists only of lowercase or uppercase letters.
  • $C_i$ is an integer representing the color $(0 \leq C_i \leq 7)$

Output

The output consists of 8 lines of integers. On line $1$, line $2$, $\dots$, line $8$, output the number of coders corresponding to colors $0,1,...,7$, respectively.

Sample

Sample 1
Input
3
hibit 3
KowerKoint 5
Michirakara 1
Output
0
1
0
1
0
1
0
0

There is $1$ $1$ coder (Michirakara), $1$ $3$ coder (hibit), and $1$ $5$ coder (KowerKoint). Note that you must output 0 even if no coder of the corresponding color exists.

Sample 2
Input
4
Michirakara 1
Michirakara 2
hibit 3
hibit 2
Output
0
0
2
0
0
0
0
0

In the end, both Michirakara and hibit are $2$ coders. Colors can not only go up but also go down.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。