AtCoder Beginner Contest 094
C
Many Medians
AtCoder
⌀ 566
原题
← BD →
翻译中…

Problem Statement

翻译中…

When $l$ is an odd number, the median of $l$ numbers $a_1, a_2, ..., a_l$ is the $(\frac{l+1}{2})$-th largest value among $a_1, a_2, ..., a_l$.

翻译中…

You are given $N$ numbers $X_1, X_2, ..., X_N$, where $N$ is an even number. For each $i = 1, 2, ..., N$, let the median of $X_1, X_2, ..., X_N$ excluding $X_i$, that is, the median of $X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N$ be $B_i$.

翻译中…

Find $B_i$ for each $i = 1, 2, ..., N$.

翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 200000$
  • $N$ is even.
  • $1 \leq X_i \leq 10^9$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
X_1 X_2 ... X_N

翻译中…

Output

翻译中…

Print $N$ lines. The $i$-th line should contain $B_i$.

翻译中…

样例

Input #1
4
2 4 4 3
Output #1
4
3
3
4
- Since the median of $X_2, X_3, X_4$ is $4$, $B_1 = 4$. - Since the median of $X_1, X_3, X_4$ is $3$, $B_2 = 3$. - Since the median of $X_1, X_2, X_4$ is $3$, $B_3 = 3$. - Since the median of $X_1, X_2, X_3$ is $4$, $B_4 = 4$.
Input #2
2
1 2
Output #2
2
1
Input #3
6
5 5 4 4 3 3
Output #3
4
4
4
4
4
4
题目信息
题号
arc095_a
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。