結果
| 問題 | No.2195 AND Set |
| コンテスト | |
| ユーザー |
deepjuggling
|
| 提出日時 | 2023-01-20 22:24:50 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,214 bytes |
| 記録 | |
| コンパイル時間 | 259 ms |
| コンパイル使用メモリ | 96,096 KB |
| 実行使用メモリ | 97,404 KB |
| 最終ジャッジ日時 | 2026-07-27 19:35:13 |
| 合計ジャッジ時間 | 9,868 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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