각 참가자의 느림 값에 따라 깃발을 든 사람 뒤로 줄을 서는 대열에서, 주어진 시각에 특정 좌표 범위에 서 있는 사람 수를 구하는 질의에 답한다.
어려움8이분 탐색누적 합정렬시뮬레이션아직 제출이 없습니다시간 제한2초메모리 제한256 MBAt 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.