Median - MarisaOJ: Marisa Online Judge

Median

Time limit: 1000 ms
Memory limit: 256 MB
For an empty set S, you need to process q queries: - 1x: If the set does not contain x at this point, add the element x to the set. Otherwise, remove x from the set - 2: Find the median in the set. If the elements are sorted in ascending order, and n is the number of elements in the set, if n is odd, the median is the element at index n+12; if n is even, the median is the average of the elements at indices n2 and n2+1. The set S at this point has at least one element. Index starts with 1. ### Input - The first line contains an integer q. - The next q lines, each containing a query in the specified format. ### Output - Print a number as the answer for each query of type 2. If the answer is a real number, round it to one decimal place. ### Constraints - 1≤q≤105. - 1≤x≤109. ### Sample test Input 815216215181102 Output: 55.58