結果
問題 | No.2195 AND Set |
ユーザー |
|
提出日時 | 2023-01-20 21:34:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 710 ms / 2,000 ms |
コード長 | 588 bytes |
コンパイル時間 | 233 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 87,528 KB |
最終ジャッジ日時 | 2024-06-23 09:27:47 |
合計ジャッジ時間 | 10,271 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 |
ソースコード
q = int(input())now = [0]*(35)s = set()cnt = 0for i in range(q):l = list(map(int,input().split()))t = l[0]if t == 1:x = l[1]if x in s:continueelse:s.add(x)for j in range(35):if (x>>j) & 1:now[j] += 1cnt += 1elif t == 2:x = l[1]if x in s:s.discard(x)for j in range(35):if (x>>j) & 1:now[j] -= 1cnt -= 1else:if cnt == 0:print(-1)continueans = 0for j in range(35):if now[j] == cnt:ans += 1 << jprint(ans)