• + 0 comments
    n,queries=map(int,input().split())
    num=[i+1 for i in range(n)]
    for i in range(queries):
        l=list(map(int,input().split()))
        if len(l)==3:
            if l[1]==1:
                num=num[:l[1]-1]+num[l[2]-1::-1]+num[l[2]:]//1
            else:
                num=num[:l[1]-1]+num[l[2]-1:l[1]-2:-1]+num[l[2]:]//1
        elif l[0]==2:
            print("element {0} is at position {1}".format(l[1],num.index(l[1])+1))//2
        else:
            print("element at position {0} is {1}".format(l[1],num[l[1]-1]))
    

    which statement(1/2) takes more time cases 8-11 failed due to time out error