Created
January 18, 2026 02:08
-
-
Save maehrm/cdb0f95217cc588840872df28cc02266 to your computer and use it in GitHub Desktop.
C - Cards Query Problem https://atcoder.jp/contests/abc298/tasks/abc298_c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| N = int(input()) | |
| Q = int(input()) | |
| boxes = [[] for _ in range(N + 1)] | |
| cards = {} | |
| for _ in range(Q): | |
| t, *q = map(int, input().split()) | |
| if t == 1: | |
| i, j = q | |
| boxes[j].append(i) | |
| if i not in cards: | |
| cards[i] = set() | |
| cards[i].add(j) | |
| elif t == 2: | |
| i = q[0] | |
| print(*sorted(boxes[i])) | |
| else: | |
| i = q[0] | |
| print(*sorted(cards[i])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment