結果

問題 No.2195 AND Set
ユーザー deepjuggling
提出日時 2023-01-20 22:30:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,223 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 82,244 KB
実行使用メモリ 91,620 KB
最終ジャッジ日時 2024-06-23 10:27:09
合計ジャッジ時間 12,346 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

q = int(input())
joutai = [0 for i in range(31)]
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(len(joutai)):
            if joutai[i] == su:
                ans += 2**i
        print(ans)
   # print(s,joutai)
0