| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 13 | 10 | 9 | 75.000% |
Diana is head chef at the Batavian Authentic Prestigious Cuisine. All orders are logged to a central computer, but to organize the kitchen, each ordered item is also printed on a separate ticket. On the back of each ticket, Diana writes the corresponding table number, so servers can easily check where they need to deliver the food. When a ticket is completed, Diana pins it to a board. Of course, there could be duplicate tickets, since a table may order the same item multiple times.
Halfway through service, a disgruntled diner complains: "We have been waiting for hours, but so far we were only served tomato soup! Could you please hurry up?" Diana must address this immediately, since the reputation of the restaurant is at stake! However, in the past, some customers have been dishonest in order to demand expedited service. So, before Diana instructs the kitchen staff, the complaint must be verified.
Since the board is always up-to-date, verification is a matter of checking the relevant tickets. Let $t$ and $m$ be the table number and menu item that describe the complaint, respectively. Diana seeks to verify the following claim: "All pinned-up tickets for table $t$ correspond to menu item $m$." In particular, if there are no completed tickets for table $t$, Diana considers the claim to be true -- the customer may have misspoken, but they surely deserve extra attention!
Unfortunately, on the board, only one side of each ticket is visible (either the menu item or table number) and Diana does not have time to flip hundreds of tickets. However, by cross-referencing with the central computer, it may be possible to safely ignore certain tickets. Help Diana determine the minimum set of pinned-up tickets that need to be flipped. Or can you (dis)prove the claim without flipping any tickets? You must decide which tickets should be flipped before Diana starts doing so -- she is too strained to make deductions on the fly.
The input consists of:
A-Z) and one digit (the table number, 0-9).0-9) and an English uppercase letter $m$ (A-Z), specifying the claim: "All pinned-up tickets for table $t$ correspond to menu item $m$."The pinned-up tickets are guaranteed to correspond to (a subset of) the orders in the computer.
If, without flipping any tickets, the claim is provably true or false, output "true" or "false", respectively. Otherwise, output the minimum number of pinned-up tickets that need to be flipped, followed by their $1$-based indices, in any order.
6 4 A1 A2 B1 B2 C1 C2 A B 1 2 1 A
2 3 2
5 4 A1 B1 C2 C1 A2 2 A B 1 1 A
false
4 4 Z0 Z0 F9 F9 Z 0 9 9 4 F
true
ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2024 D번