結果

問題 No.2195 AND Set
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-01-21 10:36:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 705 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 91,332 KB
最終ジャッジ日時 2023-09-06 00:41:19
合計ジャッジ時間 11,224 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,356 KB
testcase_01 AC 63 ms
71,292 KB
testcase_02 AC 523 ms
81,920 KB
testcase_03 AC 628 ms
84,572 KB
testcase_04 AC 552 ms
83,396 KB
testcase_05 AC 671 ms
86,596 KB
testcase_06 AC 686 ms
85,248 KB
testcase_07 AC 637 ms
83,084 KB
testcase_08 AC 684 ms
85,280 KB
testcase_09 AC 592 ms
81,144 KB
testcase_10 AC 705 ms
89,504 KB
testcase_11 AC 705 ms
90,860 KB
testcase_12 AC 689 ms
90,664 KB
testcase_13 AC 696 ms
91,332 KB
testcase_14 AC 672 ms
90,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

q = int(input())
xor = 0
s = set()

bit = [0]*30
for _ in range(q):
    l = list(map(int,input().split()))
    if l[0] == 1:
        x = l[1]
        if x in s:
            continue
        s.add(x)
        for i in range(30):
            if x >> i & 1:
                bit[i] += 1
    elif l[0] == 2:
        x = l[1]
        if x in s:
            s.discard(x)
            for i in range(30):
                if x >> i & 1:
                    bit[i] -= 1
    else:

        bitwise = 0
        le = len(s)
        for i in range(30):
            if bit[i] == le:
                bitwise += 1 << i
        if le == 0:
            bitwise = -1
        print(bitwise)
0