Reverse & Sum On Interval

Правка en1, от tom, 2016-09-18 17:03:06

Hello everyone!

I've been thinking about solution to the following problem for few days and didn't come up with any reasonable idea. Could you help me out?

You're given array of n elements and q queries. Every query is one of two type:

1) Reverse interval [l, r], e.g. for array 1 2 3 4 5 when and query [2, 5] we end up with 1 5 4 3 2.

2) Ask for sum on interval [l, r].

Thanks and have a nice Sunday.

Теги queries, interval

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский tom 2016-09-18 17:03:35 9
en1 Английский tom 2016-09-18 17:03:06 456 Initial revision (published)