結果

問題 No.2195 AND Set
ユーザー ニックネームニックネーム
提出日時 2023-01-20 21:47:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 764 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 92,120 KB
最終ジャッジ日時 2023-09-05 14:02:31
合計ジャッジ時間 11,515 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,652 KB
testcase_01 AC 77 ms
71,512 KB
testcase_02 AC 610 ms
81,952 KB
testcase_03 AC 690 ms
84,480 KB
testcase_04 AC 655 ms
83,892 KB
testcase_05 AC 735 ms
82,656 KB
testcase_06 AC 764 ms
83,540 KB
testcase_07 AC 692 ms
81,904 KB
testcase_08 AC 758 ms
83,712 KB
testcase_09 AC 690 ms
81,104 KB
testcase_10 AC 712 ms
91,256 KB
testcase_11 AC 707 ms
91,080 KB
testcase_12 AC 716 ms
90,244 KB
testcase_13 AC 720 ms
92,120 KB
testcase_14 AC 706 ms
90,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a = [[0,0] for _ in range(30)]; s = set()
for _ in range(int(input())):
    q = list(map(int,input().split()))
    if q[0]==1:
        x = q[1]
        if x in s: continue
        for i in range(30): a[i][x>>i&1] += 1
        s.add(x)
    if q[0]==2:
        x = q[1]
        if x not in s: continue
        for i in range(30): a[i][x>>i&1] -= 1
        s.remove(x)
    if q[0]==3:
        ans = 0
        for i,(p,q) in enumerate(a):
            if not p and q: ans |= 1<<i
        print(ans if s else -1)
0