4433: Make Rounddog Very Happy

内存限制:128 MB 时间限制:6 S 标准输入输出
题目类型:传统 评测方式:Special Judge 上传者:
提交: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