• + 1 comment
    def dynamicArray(n, q):
        # Write your code here
        l=0
        la=[]
        a=[]
        for i in range(n):
            a.append(list())
        for i in range(len(q)):
            if q[i][0]==1:
                idx=((q[i][1] ^ l)%n)
                a[idx].append(q[i][2])
            if q[i][0]==2:
                idx=((q[i][1] ^ l)%n)
                l=a[idx][q[i][2]%len(a[idx])]
                la.append(l)
        return la