RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00666

Bingo

Unrated 레이팅 미적용
난이도
1s
시간 제한
512MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

It’s time to play Bingo!
To play Bingo, you need a game master and a drum with 90 balls, each containing
a number from 1 to 90, sucha that every number appears on exactly one ball.
Before the game starts, the game master gives each of the \(n\) players a board of
size \(5 \times 5\). Each field of the board contains an integer between 1 and 90, where
all the integers on the board are distinct. Each player gets a unique board.
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 \(x\)\(i\), he announces that number and puts the ball aside. The players then check their boards
and, if they have the drawn number, they mark it.
When a player marks all the 5 numbers in a row, column, main diagonal or antidiagonal, he has a Bingo!
and shouts it out. The game ends and that player wins.
To make the game more interesting, the game master has decided to introduce an additional rule. Namely,
the game master will draw \(m\) balls from the drum before anyone is allowed to shout Bingo! (even if he
has already marked all the numbers in a row, column, or diagonal).
But, as soon as the game master drew \(m\) balls, there was a commotion: all the players shouted Bingo! at
the same time.
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 \(m\) balls, i.e. which players had all the numbers
marked in at least one row, column, or diagonal.

제약

Subtask 1 (12 points): There is only one player, i. e. \(n = 1\)

Subtask 2 (22 points): At most one player will have Bingo!

Subtask 3 (16 points): No additional constraints.

입력 형식

The first line contains the integer \(n\) (\(1 \le n \le 50\)), the number of players.
Then, \(n\) times six lines follows:
• 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 and 90, which describe the player’s board. All the
integers on the board are distinct.
The next line contains the integer \(m\) (\(1 \le m \le 90\)), the number of balls the game master drew before the
players shouted Bingo!.
The next line contains a sequence of \(m\) integers between 1 and 90, the numbers the game master drew
from the drum. Each number is drawn at most once.

출력 형식

In the first line, output \(k\), the number of players that had a Bingo! after drawing \(m\) balls.
In the next \(k\) lines, output the names of the players that had a Bingo! after drawing \(m\) balls. The names
should be output in the same order as they appear in the input.

서브태스크
서브태스크점수설명

1

12점

There is only one player, i. e. \(n = 1\)

2

22점

At most one player will have Bingo!

3

16점

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
예제 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
예제 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
설명

Clarification of the first example:
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.
Clarification of the second example:
Only 4 balls were drawn, so no player can have marked all the 5 numbers in a row, column, or diagonal.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2023/2024 Contest 4

평가 및 의견

Bingo

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Bingo

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8