AtCoder Grand Contest 053
翻译中…
Problem Statement
翻译中…
We have $2N$ cards, with ID numbers from $1$ through $2N$. Card $i$ has a value of $V_i$. Takahashi and Aoki will do the following procedure $N$ times so that each of them gets $N$ cards.
翻译中…
- First, Takahashi chooses one card that is not yet chosen and gets it. Then, Aoki chooses the card whose ID number is the median of those of the cards not yet chosen and gets it.
翻译中…
Find the maximum possible sum of the values of cards Takahashi has in the end.
翻译中…
Constraints
翻译中…
$1\leq N\leq 2\times 10^5$$0\leq V_i\leq 10^9$$V_i$is an integer.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
V_1 V_2 \cdots V_{2N}
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
3
1 2 3 4 5 6
Output #1
15
Takahashi can get Cards $4$, $5$, and $6$ as follows:
- First, Takahashi chooses Card $6$, which makes Aoki choose Card $3$.
- Next, Takahashi chooses Card $5$, which makes Aoki choose Card $2$.
- Lastly, Takahashi chooses Card $4$, which makes Aoki choose Card $1$.
Input #2
4
1 4 5 8 7 6 3 2
Output #2
20
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。