結果
問題 | No.2195 AND Set |
ユーザー | shobonvip |
提出日時 | 2023-01-20 21:45:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 761 ms / 2,000 ms |
コード長 | 468 bytes |
コンパイル時間 | 317 ms |
コンパイル使用メモリ | 87,104 KB |
実行使用メモリ | 91,220 KB |
最終ジャッジ日時 | 2023-09-05 13:59:55 |
合計ジャッジ時間 | 11,233 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
71,364 KB |
testcase_01 | AC | 76 ms
71,440 KB |
testcase_02 | AC | 616 ms
81,716 KB |
testcase_03 | AC | 700 ms
84,580 KB |
testcase_04 | AC | 633 ms
83,144 KB |
testcase_05 | AC | 760 ms
85,416 KB |
testcase_06 | AC | 759 ms
83,388 KB |
testcase_07 | AC | 687 ms
81,884 KB |
testcase_08 | AC | 755 ms
84,876 KB |
testcase_09 | AC | 631 ms
80,168 KB |
testcase_10 | AC | 755 ms
89,768 KB |
testcase_11 | AC | 761 ms
89,912 KB |
testcase_12 | AC | 751 ms
91,220 KB |
testcase_13 | AC | 750 ms
89,872 KB |
testcase_14 | AC | 757 ms
90,824 KB |
ソースコード
S = set() Q = int(input()) v = [0] * 30 for _ in range(Q): t = list(map(int,input().split())) if t[0] == 1: x = t[1] if x in S: continue for i in range(30): if x >> i & 1: v[i] += 1 S.add(x) elif t[0] == 2: x = t[1] if x not in S: continue for i in range(30): if x >> i & 1: v[i] -= 1 S.remove(x) else: ret = 0 r = len(S) if r == 0: print(-1) continue for i in range(30): if v[i] == r: ret += 1 << i print(ret)