#P14118. [SCCPC 2021] Hotpot
[SCCPC 2021] Hotpot
题目描述
Sichuan hotpot is one of the most famous dishes around the world. People love its spicy taste.
There are tourists, numbered from to , sitting around a hotpot. There are types of ingredients for the hotpot in total and the -th tourist favors ingredient most. Initially, every tourist has a happiness value of and the pot is empty.
The tourists will perform moves one after another, where the -th (numbered from to ) move is performed by tourist . When tourist moves:
- If ingredient exists in the pot, he will eat them all and gain happiness value.
- Otherwise, he will put one unit of ingredient into the pot. His happiness value remains unchanged.
Your task is to calculate the happiness value for each tourist after moves.
输入格式
There are multiple test cases. The first line of the input contains an integer () indicating the number of test cases. For each test case:
The first line contains three integers , and (, , ) indicating the number of tourists, the number of types of ingredients and the number of moves.
The second line contains integers () where indicates the favorite ingredient of tourist .
It's guaranteed that neither the sum of nor the sum of of all the test cases will exceed .
输出格式
For each test case output integers in one line separated by a space, where indicates the happiness value of tourist after moves.
Please, DO NOT output extra spaces at the end of each line, or your answer might be considered incorrect!
4
3 2 6
1 1 2
1 1 5
1
2 2 10
1 2
2 2 10
1 1
0 2 1
2
2 2
0 5
提示
The first sample test case is explained as follows:
$$\begin{array}{|c|c|c|c|} \hline \textbf{Move} & \textbf{Tourist} & \textbf{Action} & \textbf{Pot after move} \\ \hline 0 & 0 & \text{Puts ingredient 1 into the pot} & \{1\} \\ \hline 1 & 1 & \text{Eats ingredient 1 in the pot} & \{\} \\ \hline 2 & 2 & \text{Puts ingredient 2 into the pot} & \{2\} \\ \hline 3 & 0 & \text{Puts ingredient 1 into the pot} & \{1, 2\} \\ \hline 4 & 1 & \text{Eats ingredient 1 in the pot} & \{2\} \\ \hline 5 & 2 & \text{Eats ingredient 2 in the pot} & \{\} \\ \hline \end{array} $$