| Author: | Pavel Mesenev | Time limit: | 2 sec | |
| Input file: | Standard input | Memory limit: | 256 Mb | |
| Output file: | Standard output |
Values arrive one at a time (n of them). After each arrival, report the median of all values seen so far. If the count so far is even, report the lower of the two middle values (this keeps every answer an integer).
The first line contains one integer n. The second line contains n space-separated integers — the values, in arrival order.
Print n lines: the median after each arrival.
1 ≤ n ≤ 2 ⋅ 105
− 109 ≤ value ≤ 109
| No. | Standard input | Standard output |
|---|---|---|
| 1 |
|
|
| 2 |
|
|