結果

問題 No.2195 AND Set
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-01-20 22:13:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 760 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 1,101 ms
コンパイル使用メモリ 86,580 KB
実行使用メモリ 91,172 KB
最終ジャッジ日時 2023-09-05 14:31:46
合計ジャッジ時間 12,340 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,328 KB
testcase_01 AC 74 ms
70,960 KB
testcase_02 AC 589 ms
81,368 KB
testcase_03 AC 652 ms
84,028 KB
testcase_04 AC 612 ms
83,036 KB
testcase_05 AC 760 ms
86,220 KB
testcase_06 AC 742 ms
84,704 KB
testcase_07 AC 709 ms
82,852 KB
testcase_08 AC 747 ms
84,612 KB
testcase_09 AC 637 ms
80,428 KB
testcase_10 AC 751 ms
89,084 KB
testcase_11 AC 743 ms
89,712 KB
testcase_12 AC 733 ms
90,148 KB
testcase_13 AC 759 ms
91,172 KB
testcase_14 AC 724 ms
90,304 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.remove(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