結果
| 問題 |
No.2195 AND Set
|
| コンテスト | |
| ユーザー |
deepjuggling
|
| 提出日時 | 2023-01-20 22:24:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,214 bytes |
| コンパイル時間 | 205 ms |
| コンパイル使用メモリ | 82,100 KB |
| 実行使用メモリ | 91,252 KB |
| 最終ジャッジ日時 | 2024-06-23 10:21:54 |
| 合計ジャッジ時間 | 11,310 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 WA * 1 |
ソースコード
q = int(input())
joutai = [0 for i in range(30)]
s = {}
ss = {}
for i in range(q):
a = list(map(int,input().split()))
if a[0] == 1:
if a[1] not in s:
b = []
x = a[1]
while x > 1:
if x % 2 == 0:
b.append("0")
else:
b.append("1")
x //= 2
b.append("1")
# print(b)
for j in range(len(b)):
if b[j] == "1":
joutai[j] += 1
s[a[1]] = 1
elif a[0] == 2:
if a[1] in s:
b = []
x = a[1]
while x > 1:
if x % 2 == 0:
b.append("0")
else:
b.append("1")
x //= 2
b.append("1")
# print(b)
for j in range(len(b)):
if b[j] == "1":
joutai[j] -= 1
s.pop(a[1])
else:
ans = 0
su = len(s)
if su == 0:
print(-1)
continue
for i in range(30):
if joutai[i] == su:
ans += 2**i
print(ans)
# print(s,joutai)
deepjuggling