Help me in solving DSSA13 problem

My issue

My code

# cook your dish here
t = int(input())
for i in range(t):
    N,K,L = map(int, input().split())
    S= list(map(int, input().split()))
    S[N-1]+=K*(L-1)
    M = max(S)
    t = 0
    for i in range(N-1):
        if(S[i]==M):
            t+=1
        if(S[N-1]==M and t==0):
            print("Yes")
        else:
            print("No")

Learning course: Kalasalingam Academy of Research and Education
Problem Link: CodeChef: Practical coding for everyone