CF371E.Subway Innovation

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Berland is going through tough times — the dirt price has dropped and that is a blow to the country's economy. Everybody knows that Berland is the top world dirt exporter!

The President of Berland was forced to leave only kk of the currently existing nn subway stations.

The subway stations are located on a straight line one after another, the trains consecutively visit the stations as they move. You can assume that the stations are on the OxOx axis, the ii -th station is at point with coordinate xix_{i} . In such case the distance between stations ii and jj is calculated by a simple formula xixj|x_{i}-x_{j}| .

Currently, the Ministry of Transport is choosing which stations to close and which ones to leave. Obviously, the residents of the capital won't be too enthusiastic about the innovation, so it was decided to show the best side to the people. The Ministry of Transport wants to choose such kk stations that minimize the average commute time in the subway!

Assuming that the train speed is constant (it is a fixed value), the average commute time in the subway is calculated as the sum of pairwise distances between stations, divided by the number of pairs (that is ) and divided by the speed of the train.

Help the Minister of Transport to solve this difficult problem. Write a program that, given the location of the stations selects such kk stations that the average commute time in the subway is minimized.

输入格式

The first line of the input contains integer nn ( 3<=n<=31053<=n<=3·10^{5} ) — the number of the stations before the innovation. The second line contains the coordinates of the stations x1,x2,...,xnx_{1},x_{2},...,x_{n} ( 108<=xi<=108-10^{8}<=x_{i}<=10^{8} ). The third line contains integer kk ( 2<=k<=n12<=k<=n-1 ) — the number of stations after the innovation.

The station coordinates are distinct and not necessarily sorted.

输出格式

Print a sequence of kk distinct integers t1,t2,...,tkt_{1},t_{2},...,t_{k} ( 1<=tj<=n1<=t_{j}<=n ) — the numbers of the stations that should be left after the innovation in arbitrary order. Assume that the stations are numbered 1 through nn in the order they are given in the input. The number of stations you print must have the minimum possible average commute time among all possible ways to choose kk stations. If there are multiple such ways, you are allowed to print any of them.

输入输出样例

  • 输入#1

    3
    1 100 101
    2
    

    输出#1

    2 3 

说明/提示

In the sample testcase the optimal answer is to destroy the first station (with x=1x=1 ). The average commute time will be equal to 1 in this way.

首页