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

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

Announcements

면접 대비

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

요약
각 광고판은 S_i일에 나타나고 다음 T의 배수일에 사라진다. 모든 광고판을 한 번 이상 보는 최소 방문 일수를 구한다.
난이도

보통10점 중 5점

유형
정렬, 그리디, 구간
정답자
아직 제출이 없습니다

문제

There are NN billboards with announcements near Kyoto University.

The ii-th billboard appears at day S_iS\_i. However, at each TT-th day, all billboards installed before this day are removed. You may assume that, on those days, no new billboards will appear.

Find the minimal number of times you need to visit the university to see each billboard at least once.

입력

The first line of input contains one integer NN (1≤N≤2⋅1051 \le N \le 2 \cdot 10^5). The second line contains NN integers S_1,S_2,…,S_NS\_1, S\_2, \ldots, S\_N. Here, S_iS\_i is the day when the ii-th billboard appears (1≤S_i≤1091 \le S\_i \le 10^9). The last line contains one integer TT (2≤T≤1092 \le T \le 10^9, S_iS\_i is not divisible by TT for any ii): the interval between successive deletions. This means the billboards are removed on days TT, 2T2T, 3T3T, and so on.

출력

Print one integer: the minimum number of visits you need to do to see each billboard at least once.

힌트

In Example 1, the first two billboards are appearing on days 1 and 2. Then those 2 billboards are removed on day 3. After that, on day 5, the last billboard appears, which is then removed on day 6. So you may visit on day 2 (to see billboards 1 and 2) and on day 5 (to see billboard 3), two times in total.

예제3

  1. 예제 1

    입력
    3
    1 2 5
    3
    
    예상 출력
    2
    
  2. 예제 2

    입력
    5
    1 1 1 1 1
    2021
    
    예상 출력
    1
    
  3. 예제 3

    입력
    9
    623690081 433933447 476190629 262703497 211047202 971407775 628894325 731963982 822804784
    128512451
    
    예상 출력
    7