最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

CF 1849B - Monsters

2023-08-16 11:28 作者:您是打尖兒還是住店呢  | 我要投稿

outputstandard output

Monocarp is playing yet another computer game. And yet again, his character is killing some monsters. There are n monsters, numbered from 1 to n, and the i-th of them has ai health points initially.

Monocarp's character has an ability that deals k damage to the monster with the highest current health. If there are several of them, the one with the smaller index is chosen. If a monster's health becomes less than or equal to 0 after Monocarp uses his ability, then it dies.


Monocarp uses his ability until all monsters die. Your task is to determine the order in which monsters will die.

Input

The first line contains a single integer t (1≤t≤104) — the number of test cases.


The first line of each test case contains two integers n and k (1≤n≤3?105; 1≤k≤109) — the number of monsters and the damage which Monocarp's ability deals.


The second line contains n integers a1,a2,…,an (1≤ai≤109) — the initial health points of monsters.

The sum of n over all test cases doesn't exceed 3?105.

Output

For each test case, print n integers — the indices of monsters in the order they die.

---------------------------------------

輸出標(biāo)準(zhǔn)輸出

Monocarp 正在玩另一個(gè)電腦游戲。 再一次,他的角色正在殺死一些怪物。 有 n 個(gè)怪物,編號(hào)從 1 到 n,其中第 i 個(gè)怪物最初有 ai 生命值。

Monocarp 的角色有一種能力,可以對(duì)當(dāng)前生命值最高的怪物造成 k 點(diǎn)傷害。 如果有多個(gè),則選擇索引較小的一個(gè)。 如果在 Monocarp 使用他的能力后怪物的生命值變得小于或等于 0,那么它就會(huì)死亡。


Monocarp 使用他的能力直到所有怪物死亡。 你的任務(wù)是確定怪物的死亡順序。

輸入

第一行包含一個(gè)整數(shù) t (1≤t≤104) — 測(cè)試用例的數(shù)量。


每個(gè)測(cè)試用例的第一行包含兩個(gè)整數(shù)n和k(1≤n≤3?105;1≤k≤109)——怪物的數(shù)量和Monocarp能力造成的傷害。


第二行包含n個(gè)整數(shù)a1,a2,…,an (1≤ai≤109)——怪物的初始生命值。

所有測(cè)試用例的 n 總和不超過 3?105。

輸出

對(duì)于每個(gè)測(cè)試用例,打印 n 個(gè)整數(shù)——按照怪物死亡順序排列的索引。

----------------------------------

每個(gè)怪物的生命值要對(duì)k求余,只是為0 的要改成k,然后保存一個(gè)二維數(shù)組,0處放生命值,剩下的放索引值,然后輸出即可,

下面是代碼:


CF 1849B - Monsters的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
睢宁县| 湖州市| 通海县| 依安县| 辉南县| 永和县| 教育| 雅安市| 新巴尔虎右旗| 怀宁县| 泰安市| 襄城县| 漳平市| 文水县| 石屏县| 夏津县| 永济市| 宁波市| 中卫市| 乌海市| 九寨沟县| 汕头市| 东台市| 彝良县| 利辛县| 海晏县| 汝阳县| 同仁县| 南涧| 太湖县| 上饶市| 德格县| 灯塔市| 荔浦县| 南和县| 金华市| 凭祥市| 新沂市| 元氏县| 广水市| 阿尔山市|