結果
問題 | No.2195 AND Set |
ユーザー | Ekiben542 |
提出日時 | 2024-03-14 22:33:14 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 655 bytes |
コンパイル時間 | 315 ms |
コンパイル使用メモリ | 81,572 KB |
実行使用メモリ | 84,388 KB |
最終ジャッジ日時 | 2024-03-14 22:33:19 |
合計ジャッジ時間 | 4,785 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
60,264 KB |
testcase_01 | AC | 36 ms
53,460 KB |
testcase_02 | TLE | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
ソースコード
def fast_bitwise_and(S): if len(S) == 0: return -1 MAX_BITS = 32 count = [0] * MAX_BITS for num in S: for bit in range(MAX_BITS): if num & (1 << bit): count[bit] += 1 result = 0 for bit in range(MAX_BITS): if count[bit] == len(S): result |= (1 << bit) return result Q = int(input().strip()) S = set() for _ in range(Q): query = list(map(int, input().strip().split())) if query[0] == 1: S.add(query[1]) elif query[0] == 2: if query[1] in S: S.remove(query[1]) elif query[0] == 3: print(fast_bitwise_and(S))