4433 Make Rounddog Very Happy

时间限制6 S
内存限制128 MB
通过率0%(0 / 0)
题目描述

The task is adapted from HDOJ 6701 - Make Rounddog Happy.

Bobo has a sequence of integers a1, a2, …, an and an integer m.

Let f(j) be the number of i where 1 ≤ ij and max {ai, …, aj} − (ji + 1) ≥ m hold. Find the value of f(1), …, f(n).

输入格式

The input consists of several test cases terminated by end-of-file.

The first line of each test case contains two integers n and m, and the second line contains n integers a1, a2, …, an.

  • 1 ≤ n ≤ 106
  • nmn
  • 1 ≤ ain
  • The sum of n does not exceed 5 × 106.
输出格式
For each test case, print n integers f(1), …, f(n).
输入输出样例
输入复制
3 0
1 3 2
3 1
1 3 2
5 2
1 2 3 4 5
输出复制
1 2 3
0 2 2
0 0 1 2 3
上传者
提交记录查看记录
题目类型传统
评测方式Special Judge
提交 / 通过0 / 0
相关讨论
暂无讨论