Deep in the galleon yard of Masthead, Indu studies rows of marks entries. One clean number will settle the guild's oldest argument. Task: After each arrival, print the median of the stream so far — defined as the element at sorted position ceil(k/2) (1-based). Input format: First line: n. Second line: n integers. Output format: Print n medians space-separated. Constraints: 1 <= n <= 4000; -10^9 <= a[i] <= 10^9.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= n <= 4000; -10^9 <= a[i] <= 10^9.
