| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 12 | 11 | 10 | 90.909% |
The board and card game Sequence is played with two standard decks of cards (not including Jokers or any special cards: only two of each suit, hearts, clubs, diamonds, and spades, consisting of cards 2ドル,ドル 3ドル,ドル 4ドル,ドル 5ドル,ドル 6ドル,ドル 7ドル,ドル 8ドル,ドル 9ドル,ドル 10ドル,ドル Jack, Queen, King and Ace) and a board with each of the cards on it, except for the Jacks. Tokens are placed on the board by each player to claim a spot as theirs.
Each card may only be played on one of its two corresponding spots on the board, and a token is placed on that spot. Each spot may only contain one token: so a card cannot be played on a particular spot on the board if there is already a token on that spot. The exception is the Jacks, since the Jacks are not represented on the board. The Jack of diamonds and clubs can be played anywhere where there is not already a token, and the Jack of hearts and spades can remove any token on the board.
Assume you have an empty starting board and are given an ordered list of moves made by the players. Each move contains information on which card was played, whether that card was used to place or remove a token, and which token on the board was placed or removed. Using this information, determine if there was an invalid move, or if the list of moves was valid.
Input starts with a single integer on it's own line, $N$ (1ドル \le N \le 104$), which indicates the number of moves. The next $N$ lines contain four values, separated by spaces:
2, 3, 4, 5, 6, 7, 8, 9, X (representing 10ドル$), J (representing Jack), Q (representing Queen), K (representing King), or A (representing Ace). The suit is a lowercase h (for hearts), c (for clubs), d (for diamonds), ors (for spades). You are guaranteed that each card will be seen at most twice, as there are only two decks in play.P or R indicating whether a token was placed or removed.If the list of moves is valid, output VALID GAME.
If the list of moves is invalid, output INVALID, followed by the first move number that makes it invalid.
5 1 5s P 5s 2 7h P 7h 3 5s P 5s 4 Jh R 5s 5 Jd P 5s
VALID GAME
6 1 2h P 2h 2 Js R 3h 3 2h P 2h 4 3h P 2h 5 4h R Qd 6 Qd P Kd
INVALID 2
4 1 2s P 2s 2 Jd P 2s 3 2s P 2s 4 Jc P 3s
INVALID 3
4 1 6c P 6c 2 Jc R 6c 3 7h P 7h 4 9d P 9d
INVALID 2
School > CS@Mines > CS@Mines HSPC 2018 G번