P2550 [AHOI2001] Lottery Drawing
Description
To enrich people's lives and support certain public welfare causes, Beita City has set up a lottery. The lottery rules are:
1. Each ticket has $7$ distinct numbers, each in the range $1\sim33$.
2. Before claiming prizes, a winning set consisting of seven distinct numbers is announced each time.
3. There are $7$ prize levels: Special Prize, and First Prize through Sixth Prize.
The prize-claiming rules are as follows:
- Special Prize: All $7$ numbers on the ticket appear in the winning set.
- First Prize: $6$ numbers on the ticket appear in the winning set.
- Second Prize: $5$ numbers on the ticket appear in the winning set.
- Third Prize: $4$ numbers on the ticket appear in the winning set.
- Fourth Prize: $3$ numbers on the ticket appear in the winning set.
- Fifth Prize: $2$ numbers on the ticket appear in the winning set.
- Sixth Prize: $1$ number on the ticket appears in the winning set.
Note: The positions of numbers on the ticket and in the winning set are not considered. For example, if the winning set is $23\ 31\ 1\ 14\ 19\ 17\ 18$, then the ticket $12\ 8\ 9\ 23\ 1\ 16\ 7$ wins the Fifth Prize because two numbers ($23$ and $1$) appear in the winning set.
Given the winning set and the numbers on several tickets bought by Xiao Ming, write a program to determine the prize results of Xiao Ming's tickets.
Input Format
The first line contains a single natural number $n$, the number of tickets Xiao Ming bought.
The second line contains $7$ natural numbers between $1$ and $33$, which are the winning numbers.
Each of the following $n$ lines contains $7$ natural numbers between $1$ and $33$, representing each of Xiao Ming's $n$ tickets.
Output Format
Output the counts of Xiao Ming's winning tickets for each prize level, in order: first the number of Special Prize winners, then the counts for First Prize through Sixth Prize.
Explanation/Hint
Constraints
For $100\%$ of the testdata, it is guaranteed that $1 \leq n \lt 1000$.
Translated by ChatGPT 5