結果
| 問題 | No.3390 Public or Private |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-02 02:03:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,027 bytes |
| 記録 | |
| コンパイル時間 | 361 ms |
| コンパイル使用メモリ | 82,512 KB |
| 実行使用メモリ | 153,944 KB |
| 最終ジャッジ日時 | 2025-12-02 02:03:52 |
| 合計ジャッジ時間 | 15,469 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 5 |
ソースコード
N, M = (int(x) for x in input().split())
offline = set()
d={}
for i in range(M):
u, v = (int(x) for x in input().split())
if u not in d:
d[u] = set()
d[u].add(v)
ans = []
Q=int(input())
for i in range(Q):
q=list(map(int, input().split()))
if q[0] == 1:
a, b = q[1], q[2]
if a not in d:
d[a] = set()
d[a].add(b)
elif b not in d[a]:
d[a].add(b)
else:
d[a].discard(b)
res = 0
for j in offline:
if a not in d or j not in d[a]:
res += 1
ans.append(N-1-res)
else:
a = q[1]
res = 0
if a not in offline:
for j in offline:
if a not in d or j not in d[a]:
res += 1
offline.add(a)
else:
offline.discard(a)
for j in offline:
if a not in d or j not in d[a]:
res += 1
ans.append(N-1-res)
for i in ans:
print(i)