제출 #161505

#제출 시각아이디문제언어결과실행 시간메모리
161505boolodifjenulaRasvjeta (COCI17_rasvjeta)Cpython 3
5 / 50
35 ms3480 KiB
N=int(input())
M=int(input())
K=int(input())
O=[i+1 for i in range (N)]
for i in range(M):
    P=int(input())
    for i in range(P-K-1,P+K):
        if -1<i<len(O):
            O[i]=0
k=-K
p=-K
s=0
for i in range(N):
    if O[i]:
        k+=1
    elif k:
        p+=1
    if k and k+p==K+1:
        s+=1
        k=-K
        p=-K
    if i==N-1 and s==0 and k:
        s+=1
print(s)
#Verdict Execution timeMemoryGrader output
Fetching results...