CF710B.Optimal Point on a Line

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given nn points on a line with their coordinates xix_{i} . Find the point xx so the sum of distances to the given points is minimal.

输入格式

The first line contains integer nn ( 1<=n<=31051<=n<=3·10^{5} ) — the number of points on the line.

The second line contains nn integers xix_{i} ( 109<=xi<=109-10^{9}<=x_{i}<=10^{9} ) — the coordinates of the given nn points.

输出格式

Print the only integer xx — the position of the optimal point on the line. If there are several optimal points print the position of the leftmost one. It is guaranteed that the answer is always the integer.

输入输出样例

  • 输入#1

    4
    1 2 3 4
    

    输出#1

    2
    
首页