The Preliminary Contest for ICPC Asia Xuzhou 2019 徐州网络赛 XKC's basketball team
XKC , the captain of the basketball team , is directing a train of?nn?team members. He makes all members stand in a row , and numbers them?1 \cdots n1?n?from left to right.
The ability of the?ii-th person is?w_iwi??, and if there is a guy whose ability is not less than?w_i+mwi?+m?stands on his right , he will become angry. It means that the?jj-th person will make the?ii-th person angry if?j>ij>i?and?w_j \ge w_i+mwj?≥wi?+m.
We define the anger of the?ii-th person as the number of people between him and the person , who makes him angry and the distance from him is the longest in those people. If there is no one who makes him angry , his anger is?-1?1?.
Please calculate the anger of every team member .
Input
The first line contains two integers?nn?and?m(2\leq n\leq 5*10^5, 0\leq m \leq 10^9)m(2≤n≤5?105,0≤m≤109)?.
The following? line contain?nn?integers?w_1..w_n(0\leq w_i \leq 10^9)w1?..wn?(0≤wi?≤109)?.
Output
A row of?nn?integers separated by spaces , representing the anger of every member .
樣例輸入復(fù)制
6 1 3 4 5 6 2 10樣例輸出復(fù)制
4 3 2 1 0 -1
隊(duì)友做的,沒大有思路。
總結(jié)
以上是生活随笔為你收集整理的The Preliminary Contest for ICPC Asia Xuzhou 2019 徐州网络赛 XKC's basketball team的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Win10系统鼠标怎么变大 Win调整鼠
- 下一篇: 关于RMQ问题的四种解法