国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(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)遵守國家法律
海丰县| 互助| 紫阳县| 阿巴嘎旗| 高安市| 万州区| 双辽市| 历史| 道真| 桃源县| 正蓝旗| 新巴尔虎右旗| 潮州市| 新闻| 襄樊市| 磐石市| 南部县| 庄河市| 连平县| 黔西县| 二手房| 贵定县| 广南县| 新巴尔虎右旗| 元氏县| 四平市| 论坛| 霍邱县| 略阳县| 永平县| 香格里拉县| 泰州市| 建湖县| 临城县| 阳新县| 公安县| 卢氏县| 桐乡市| 茂名市| 宜丰县| 治县。|