Interesting problem from Croatian olympiad

Правка en2, от JOF, 2017-12-01 19:21:55

Please help me to solve this problem.

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).

Теги segments, query, ds

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский 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 Английский JOF 2017-12-01 19:20:21 469 Initial revision (published)