Interesting problem from Croatian olympiad

Revision en1, by JOF, 2017-12-01 19:20:21

Given a permutation of 1,2...,N numbers. There are 3 types of queries.

  1. perform K times cyclic shift of the segment [l,r] to the right.

  2. perform K times cyclic shift of the segment [l,r] to the left.

  3. Print which number is at position X in current array.

Size of array N (2 ≤ N ≤ 100 000). Number of queries Q (1 ≤ Q ≤ 100 000).

Tags segments, query, ds

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English JOF 2017-12-01 19:21:55 43 Tiny change: 'Given a pe' -> 'Please help me to solve this problem.\n\nGiven a pe'
en1 English JOF 2017-12-01 19:20:21 469 Initial revision (published)