#P2550. [AHOI2001] 彩票摇奖

[AHOI2001] 彩票摇奖

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 77 distinct numbers, each in the range 1331\sim33.
  2. Before claiming prizes, a winning set consisting of seven distinct numbers is announced each time.
  3. There are 77 prize levels: Special Prize, and First Prize through Sixth Prize.

The prize-claiming rules are as follows:

  • Special Prize: All 77 numbers on the ticket appear in the winning set.
  • First Prize: 66 numbers on the ticket appear in the winning set.
  • Second Prize: 55 numbers on the ticket appear in the winning set.
  • Third Prize: 44 numbers on the ticket appear in the winning set.
  • Fourth Prize: 33 numbers on the ticket appear in the winning set.
  • Fifth Prize: 22 numbers on the ticket appear in the winning set.
  • Sixth Prize: 11 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 1823\ 31\ 1\ 14\ 19\ 17\ 18, then the ticket 12 8 9 23 1 16 712\ 8\ 9\ 23\ 1\ 16\ 7 wins the Fifth Prize because two numbers (2323 and 11) 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 nn, the number of tickets Xiao Ming bought.

The second line contains 77 natural numbers between 11 and 3333, which are the winning numbers.

Each of the following nn lines contains 77 natural numbers between 11 and 3333, representing each of Xiao Ming's nn 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.

2
23 31 1 14 19 17 18
12 8 9 23 1 16 7
11 7 10 21 2 9 31
0 0 0 0 0 1 1

Hint

Constraints

For 100%100\% of the testdata, it is guaranteed that 1n<10001 \leq n \lt 1000.

Translated by ChatGPT 5