My problem is:↵
Given a sequence of integers (a_n): a_1, a_2, ..., a_n.↵
We do Q queries, each of them (l, r) requires reverse elements from a_l to a_r.↵
↵
For examples,↵
Given a sequence: 2, 3, 4, 5.↵
The query (1, 3) changes the sequence into 4, 3, 2, 5.↵
↵
After performing Q queries, the problem asks us to print out the modified sequence.↵
↵
How to solve this problem, if n and Q are large integers (such as 10^5)?↵
↵
I hear that the solution uses an approach of Splay Tree.↵
↵
Please help me and thank you.
Given a sequence of integers (a_n): a_1, a_2, ..., a_n.↵
We do Q queries, each of them (l, r) requires reverse elements from a_l to a_r.↵
↵
For example
Given a sequence: 2, 3, 4, 5.↵
The query (1, 3) changes the sequence into 4, 3, 2, 5.↵
↵
After performing Q queries, the problem asks us to print out the modified sequence.↵
↵
How to solve this problem, if n and Q are large integers (such as 10^5)?↵
↵
I hear that the solution uses an approach of Splay Tree.↵
↵
Please help me and thank you.