Source Code
def solve():
    inp=(input())
    inp = inp.split(' ')
    n=int(inp[0])
    e=int(inp[1])
    k=int(inp[2])

    counter =0
    arr = []
    for i in range(int(n/k)):
        for j in range(k):
            arr.append(i+1)
            counter=counter+1

    lastVal = arr[-1]

    for i in range(n%k):
        arr.append(lastVal+1)


    for i in range(n):
        rng = range((max(1 ,(i+1)-e)-1), (min(n ,(i+1)+e)))
        maxNum = 0
        maxNumInd = 0


        for j in rng:
            if arr[j] > maxNum:
                maxNum = arr[j]
                maxNumInd = j


        if maxNum==0: return "No"
        else: arr[maxNumInd] = 0


    return "Yes"

print(solve())
Copy
Scientific Study hamzah_lababidi
Python 2
16 ms
3.1 MB
Runtime Error