結果

問題 No.2195 AND Set
ユーザー tassei903tassei903
提出日時 2023-01-20 21:39:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,053 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 91,024 KB
最終ジャッジ日時 2023-09-05 13:51:40
合計ジャッジ時間 6,498 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,448 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

m = 30
q = ni()
p = [0] * m
from collections import defaultdict
k = 0
d = defaultdict(int)
for _ in range(q):
    que = na()
    if que[0] == 1:
        x = que[1]
        if d[x] == 0:
            d[x] = 1
            k += 1
            for i in range(m):
                if x >> i & 1 ^ 1:
                    p[i] += 1
    elif que[0] == 2:
        x = que[1]
        if d[x] == 1:
            d[x] = 0
            k-=1
            for i in range(m):
                if x >> i & 1 ^ 1:
                    p[i] -= 1
    else:
        if k == 0:
            print(-1)
            exit()
        s = 0
        for i in range(m):
            if p[i] == 0:
                s += 1<<i
        print(s)
0