문제
It’s time to play Bingo!
To play Bingo, you need a game master and a drum with
Before the game starts, the game master gives each of the
After the players receive their boards, the game can begin.
The game master starts drawing balls from the drum. After drawing a ball with the number
When a player marks all the
To make the game more interesting, the game master has decided to introduce an additional rule. Namely, the game master will draw
But, as soon as the game master drew
The game master is confused and doesn’t know who to trust. To resolve this situation, he asked you for help. Determine which players had a Bingo! after drawing
입력
The first line contains the integer
Then,
The first of these lines contains a string of at most
20 lowercase English letters, the name of the player. No two players have the same name.Then five lines follow with five integers between
1 and90 , which describe the player’s board. All the integers on the board are distinct.
The next line contains the integer
The next line contains a sequence of
출력
In the first line, output
In the next
부분문제
번호 | 점수 | 조건 |
---|---|---|
#1 | 24점 | There is only one player, i. e. |
#2 | 44점 | At most one player will have Bingo! |
#3 | 32점 | No additional constraints. |
예제1
3
babylasagna
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
25 26 27 28 29
30 31 32 33 34
nataliebalmix
10 20 30 40 50
11 21 31 41 51
12 22 32 42 52
13 23 33 43 53
14 24 34 44 54
lettri
89 88 87 86 10
85 84 83 11 82
81 80 12 79 78
77 13 76 75 74
14 73 72 71 70
6
10 11 12 13 14 15
3
babylasagna
nataliebalmix
lettri
babylasagna
has a Bingo! in the first row.
nataliebalmix
has a Bingo! in the first column.
lettri
has a Bingo! in the diagonal starting from the bottom-left corner to the top-right corner.
예제2
1
honi
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
4
1 2 49 50
0
Only
예제3
4
rim
15 23 14 26 34
12 11 13 16 17
90 67 45 24 18
85 82 77 66 22
62 71 32 35 7
tim
61 89 25 63 12
29 30 31 32 33
11 17 42 24 18
88 82 77 66 22
44 71 54 35 7
dagi
15 23 14 26 34
12 11 13 16 17
90 67 45 24 18
85 82 77 66 22
62 71 36 35 7
dim
15 23 14 26 34
12 11 13 16 17
90 67 45 24 18
85 82 77 66 22
42 51 32 33 7
7
15 11 66 7 42 30 61
1
tim