시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 256 MB | 49 | 42 | 40 | 90.909% |
At the opening ceremony of IOI 2018, N contestants marches along a line, which is represented by a number line. All contestants head for the positive direction of the number line. At time 0, the i-th contestant (1 ≤ i ≤ N, counted from the front) stands at coordinate −i. In addition, IOI-chan, the flag-bearer, stands at coordinate 0.
Each contestant has a value called slowness. The i-th contestant has slowness Di. The contestants keep the following rule:
IOI-chan moves a distance 1 in the positive direction on the line per unit time. A contestant moves instantly whenever the condition described above is satisfied.
You are a reporter to cover the opening ceremony. You had to take photos, but you were fast asleep during the whole ceremony. It couldn’t be helped—you decided to cheat by taking photos of the hall and then drawing pictures of the people on them.
In order not to get caught cheating, or to estimate the time to draw pictures, you want to know the following Q values:
Given the slowness of each contestant and the data of the Q questions, write a program which calculates the number of people satisfying the condition for each question.
Read the following data from the standard input.
Write Q lines to the standard output. The j-th line (1 ≤ j ≤ Q) of the output should contain the answer to the j-th question.
There are no additional constraints.
3 6 2 5 3 1 2 4 2 2 4 3 2 4 4 2 4 5 2 4 6 2 4
0 1 1 2 1 2
In this sample input, the contestants and IOI-chan move as follows.
In the following, interval [L, R] denotes the set of points of coordinate between L and R, inclusive, on the number line.
4 2 1 1 1 1 2 1 4 1 3 6
2 0
6 6 11 36 28 80 98 66 36 29 33 190 171 210 18 20 100 1000 900 1100 92 87 99 200 100 300
1 6 0 5 2 7