After submitting, it shows partially correct and a TLE error.
How do I solve overcome that error?
I am pasting my code below, can anyone help?
problem code: INOI1202
# n = list(map(int, input()))
N = int(input())
M = list(map(int, input().split(" ")))
size = N
flag = 0
a3 = []
maxSum = 0
for x in range(size):
if flag == 0:
n = []
for i in range(1, N + 1):
n.append(i)
for i in range(N):
if M[i] + n[i] > maxSum:
maxSum = M[i] + n[i]
a3.append(maxSum)
flag = 1
else:
maxSum = 0
max = size - 1
tempf = n[0]
for i in range(size-1):
n[i] = n[i+1]
n[max] = tempf
w = []
for i in n:
w.append(i)
for i in range(N):
if M[i] + w[i] > maxSum:
maxSum = M[i] + w[i]
a3.append(maxSum)
for i in a3:
print(i,end=" ")