Circular rotation of a list in python: terminated due to timeout -
i have tried circulation rotation of list a , tried print elements of list, program getting terminated when test cases used large numbers n, k, q.
n,k,q = raw_input().strip().split(' ') n,k,q = [int(n),int(k),int(q)] = map(int,raw_input().strip().split(' ')) b=list(a) a0 in xrange(q):     m = int(raw_input().strip())      j in xrange(k):         #print         l=a[n-1]         in range(n-2,-1,-1):             a[i+1] = a[i]         a[0] = l     print a[m]     a=list(b)  
 
Comments
Post a Comment