• + 0 comments

    I did something similar with Python, I imagined it as conveyer belt going back and forth, outcome for mod moves it ahead and q pulls it back...

    #!/bin/python3
    
    n, k, q = list(map(int, input().rstrip().split()))
    
    arr = list(map(int, input().rstrip().split()))
    
    while q:
    
        offset = int(input()) - (k%n)
    		
        if offset < 0:
            offset += n
    				
        print(arr[offset])
        q -= 1