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

Paradoks

설명

One full moon evening, when the clock struck midnight, five friends found them-
selves ready to play a game as mysterious as that night.
They sat in a circle, in clockwise order: Igor, Lea, Marino, Sonja, and Viktor.
The game consists of \(N\) rounds. The first round is started by Sonja, and each
subsequent round is started by the winner of the previous round.
Each player holds \(N\) cards in their hand. All cards are colorless and have a natural
number between 1 and 9 on them. When a player plays a card, they choose the color for that card. They
may choose one of four colors (red, blue, yellow, green) provided that such a card (combination of that
number and color) has not already been played in the game. In the rest of the text, the term "playing a
blue card," for example, refers to the procedure of playing the card and declaring it to be blue.
In each round, the players, in clockwise order, play one card each until the turn reaches the player who
started the round, i.e., until each player has played one card. The first card played in a round determines
the so-called round color, and all subsequent players are required to play cards of that color. If any player
fails to play a card of the current round color, it is assumed that the player has no such color card in their
hand – and they are prohibited from playing that color card for the rest of the game.
The winner of each round is:
• The person who played the red card with the highest number.
• If no red cards were played, the person who played the highest number of the round color.
Sometimes, players make a move that they should not have: either they play a card that has already been
played or play a card of a color they previously declared they no longer have. This play is called a paradox
(in Croatian: "paradoks"). When a paradox occurs, the play is completely ignored in calculating the
for the rest of the game, it is treated as though it has not yet been played. It is guaranteed that the first
player in a round will never play a paradox in that round.
Our heroes haven’t seen each other for a long time and haven’t been paying close attention to the game,
so they ask for your help. Write a program that, for the sequentially listed played cards by round, prints
how many paradoxes occurred and lists them in the order they happened. For each paradox, print the

제약
입력 형식

The first line of input contains a natural number \(N\) (\(1 \le N \le 10\)), the number of rounds.
In the next \(N\) lines of input, there are 5 words, each 2 characters long, representing the cards played in
that round, in the order they were played. (Caution: the first player in each round is not necessarily the
same.)
The first character of each word represents the color of the card the player played and will be one of the
following letters: ’C’ –red, ’P’ – blue, ’Y’ – yellow, ’Z’ – green. The second character of each word will be
a natural number between 1 and 9 (inclusive), representing the number on the card.
For example, the word ’Y5’ would represent a yellow card with the number 5.

출력 형식

Print a single number \(a\), the number of paradoxes that occurred.
In next \(a\) lines, for each of the \(a\) paradoxes, print the round number and the name of the player who
caused it, in uppercase letters.
Paradoxes should be printed in the order they occurred.

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

1

10점

Sonja will be the winner of all rounds, and all paradoxes will occur due to repeating a card that has already been played.

2

10점

All paradoxes that occur will be caused by repeating a card that has already been played.

3

30점

No additional constraints.

예제 1
입력
4
Y5 Z3 Y6 C2 Y1
Z4 Z7 Z2 Y2 P3
Z6 Z7 Z1 Y2 C2
P6 P8 P8 Z7 Y9
출력
6
2 VIKTOR
3 SONJA
3 LEA
4 VIKTOR
4 IGOR
4 LEA
예제 2
입력
3
P1 Y9 Z5 Y1 Z5
P5 Y7 Z3 Y8 P1
C6 Y8 P5 Z1 Z8
출력
4
1 MARINO
2 MARINO
3 VIKTOR
3 IGOR
예제 3
입력
1
Y4 P9 Y8 Z5 Z3
출력
0
설명

Clarification of the first example:
The course of the game is shown in the picture below (on the next page).
In round 1, Viktor and Lea did not play yellow cards (the color of the round), so it is assumed that they
have no yellow cards left in their hands and are prohibited from declaring any card as yellow for the rest
of the game. This is the reason for Viktor’s paradox in round 2 and Lea’s paradox in the last round.
Notice: that in round 2, due to the paradox, Viktor’s move is ignored, and we don’t draw any further
conclusions. Also, the card Y2 is not considered played, which is why Igor does not get a paradox for
playing that card in round 3.
All the paradoxes in rounds 3 and 4 (except the last one) happened because a card was played that had
already been played earlier in the game.

문제 정보

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

출처 COCI 2024/2025 Contest 2

평가 및 의견

Paradoks

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

Log in to rate problems.

개별 의견

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

풀이 제출

Paradoks

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