五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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)遵守國家法律
广水市| 淮北市| 佛冈县| 乐安县| 芦山县| 内乡县| 龙南县| 宝坻区| 大英县| 巩留县| 英吉沙县| 平利县| 鄄城县| 民乐县| 阜宁县| 扶绥县| 吐鲁番市| 太原市| 莱阳市| 宁远县| 高阳县| 如东县| 阳新县| 道孚县| 龙泉市| 利津县| 林州市| 衡山县| 钦州市| 汉源县| 夹江县| 彭州市| 汉川市| 丹江口市| 鄂州市| 日喀则市| 永胜县| 平舆县| 乐清市| 东乌| 泾阳县|