You are viewing a single comment's thread. Return to all comments →
from collections import *
n=int(input()) l=list(map(int,input().split())) ans=[] for i in range(0,n+1):
d=deque(l) d.rotate(i) pr=1 for j in range(0,len(d)): pr=pr+(j+1)*d[j] ans.append(pr)
print(max(ans)-1)
Why does this Solution gives a TLE ?? It can be the easiest amongst all?
Seems like cookies are disabled on this browser, please enable them to open this website
Game Of Rotation
You are viewing a single comment's thread. Return to all comments →
from collections import *
n=int(input()) l=list(map(int,input().split())) ans=[] for i in range(0,n+1):
print(max(ans)-1)
Why does this Solution gives a TLE ?? It can be the easiest amongst all?