CF163B.Lemmings

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

As you know, lemmings like jumping. For the next spectacular group jump nn lemmings gathered near a high rock with kk comfortable ledges on it. The first ledge is situated at the height of hh meters, the second one is at the height of 2h2h meters, and so on (the ii -th ledge is at the height of ihi·h meters). The lemmings are going to jump at sunset, and there's not much time left.

Each lemming is characterized by its climbing speed of viv_{i} meters per minute and its weight mim_{i} . This means that the ii -th lemming can climb to the jj -th ledge in minutes.

To make the jump beautiful, heavier lemmings should jump from higher ledges: if a lemming of weight mim_{i} jumps from ledge ii , and a lemming of weight mjm_{j} jumps from ledge jj (for i<ji<j ), then the inequation mi<=mjm_{i}<=m_{j} should be fulfilled.

Since there are nn lemmings and only kk ledges ( k<=nk<=n ), the kk lemmings that will take part in the jump need to be chosen. The chosen lemmings should be distributed on the ledges from 11 to kk , one lemming per ledge. The lemmings are to be arranged in the order of non-decreasing weight with the increasing height of the ledge. In addition, each lemming should have enough time to get to his ledge, that is, the time of his climb should not exceed tt minutes. The lemmings climb to their ledges all at the same time and they do not interfere with each other.

Find the way to arrange the lemmings' jump so that time tt is minimized.

输入格式

The first line contains space-separated integers nn , kk and hh ( 1<=k<=n<=1051<=k<=n<=10^{5} , 1<=h<=1041<=h<=10^{4} ) — the total number of lemmings, the number of ledges and the distance between adjacent ledges.

The second line contains nn space-separated integers m1,m2,...,mnm_{1},m_{2},...,m_{n} ( 1<=mi<=1091<=m_{i}<=10^{9} ), where mim_{i} is the weight of ii -th lemming.

The third line contains nn space-separated integers v1,v2,...,vnv_{1},v_{2},...,v_{n} ( 1<=vi<=1091<=v_{i}<=10^{9} ), where viv_{i} is the speed of ii -th lemming.

输出格式

Print kk different numbers from 11 to nn — the numbers of the lemmings who go to ledges at heights h,2h,...,khh,2h,...,kh , correspondingly, if the jump is organized in an optimal way. If there are multiple ways to select the lemmings, pick any of them.

输入输出样例

  • 输入#1

    5 3 2
    1 2 3 2 1
    1 2 1 2 10
    

    输出#1

    5 2 4
    
  • 输入#2

    5 3 10
    3 4 3 2 1
    5 4 3 2 1
    

    输出#2

    4 3 1
    

说明/提示

Let's consider the first sample case. The fifth lemming (speed 10) gets to the ledge at height 2 in minutes; the second lemming (speed 2) gets to the ledge at height 4 in 2 minutes; the fourth lemming (speed 2) gets to the ledge at height 6 in 3 minutes. All lemmings manage to occupy their positions in 3 minutes.

首页