아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Fast Forward

시간 제한2초메모리 제한1024 MB

요약
순환 재생목록의 각 시작 곡에 대해, 광고 사이 간격이 최소 c초가 되도록 강제될 때 재생되는 광고 수를 구한다.
난이도

보통10점 중 4점

유형
투 포인터, 누적 합, 배열
정답자
아직 제출이 없습니다

문제

Gry has started to use the new Expify song streaming platform. Since, Gry does not want to spend money Expify forces him to listen to advertisements. An advertisement can be played only after some song (it cannot be played in the middle) and only if the time from the end of the previous advertisement is at least cc seconds.

Gry has a circular playlist with nn songs where the duration of the ii-th song is d_id\_i seconds. He wants to minimize the number of advertisements, so, he wants to find out how many advertisements will be if he starts listening to his whole playlist from ii-th song, i.e., the circular playlist stops playing after nn songs.

We suppose that there is an advertisement right before Gry starts listening. Neither this advertisement nor the one, after the playlist stops, count.

입력

  • One line containing the number of songs in the playlist nn, and the refresh time between advertisements cc (1≤n≤1061 \leq n \leq 10^6, 1≤c≤1091 \leq c \leq 10^9)
  • One line containing the nn durations of the songs d_1…d_nd\_1 \ldots d\_n (1≤d_i≤1031 \leq d\_i \leq 10^3)

출력

Output the number of advertisements if Gry starts listening to the playlist from the ii-th song.

예제2

  1. 예제 1

    입력
    7 7
    1 1 1 1 1 1 1
    
    예상 출력
    0 0 0 0 0 0 0
    
  2. 예제 2

    입력
    3 3
    1 1 3
    
    예상 출력
    0 1 1