Skip to content

Instantly share code, notes, and snippets.

@maehrm
Created January 13, 2026 06:58
Show Gist options
  • Select an option

  • Save maehrm/b823838ba20c8d0f575777c2c9ba9455 to your computer and use it in GitHub Desktop.

Select an option

Save maehrm/b823838ba20c8d0f575777c2c9ba9455 to your computer and use it in GitHub Desktop.
N, M, Q = map(int, input().split())
contests = [set() for _ in range(N)]
all_ok = [False] * N
for _ in range(Q):
t, *query = map(int, input().split())
if t == 1:
x, y = query[0] - 1, query[1] - 1
contests[x].add(y)
elif t == 2:
x = query[0] - 1
all_ok[x] = True
else:
x, y = query[0] - 1, query[1] - 1
if all_ok[x]:
print("Yes")
else:
print("Yes" if y in contests[x] else "No")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment