結果

問題 No.2195 AND Set
ユーザー deepjugglingdeepjuggling
提出日時 2023-01-20 22:30:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,223 bytes
コンパイル時間 703 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 93,600 KB
最終ジャッジ日時 2023-09-05 14:49:43
合計ジャッジ時間 13,235 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,012 KB
testcase_01 AC 76 ms
71,344 KB
testcase_02 AC 673 ms
81,024 KB
testcase_03 AC 759 ms
85,988 KB
testcase_04 AC 672 ms
82,740 KB
testcase_05 AC 849 ms
85,468 KB
testcase_06 AC 854 ms
86,036 KB
testcase_07 AC 696 ms
80,968 KB
testcase_08 AC 811 ms
85,192 KB
testcase_09 WA -
testcase_10 AC 965 ms
92,204 KB
testcase_11 AC 957 ms
93,600 KB
testcase_12 AC 939 ms
92,648 KB
testcase_13 AC 957 ms
93,136 KB
testcase_14 AC 941 ms
92,540 KB
権限があれば一括ダウンロードができます

ソースコード

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