Submission #165581

#TimeUsernameProblemLanguageResultExecution timeMemory
165581boolodifjenulaTimovi (COCI18_timovi)Cpython 3
80 / 80
507 ms12748 KiB
N,K,M=map(int,input().split())
L=N*[0]
i=-1
k=1
c=(2*K+(N-2)*K*2)
#print(c)
if M//c:
    c=M//c
    L=[K*c]+(N-2)*[2*K*c]+[K*c]
    M-=(c*2*K+(N-2)*2*K*c)
    #print(L,M)
while M>0:
    if k: i+=1
    else: i-=1
    if M>K:
        L[i]+=K
        M-=K
    else:
        L[i]+=M
        M=0
        break
    if i==N-1:
        k=0
    if i==0:
        k=1
for j in range(N): print(L[j],end=" ")
        
    
#Verdict Execution timeMemoryGrader output
Fetching results...