What data structure can be used to quickly perform such operations?

Revision en1, by Nextrix, 2022-05-16 16:19:06

Two sorted arrays A,B are given. You need to process requests of the following type:

1 l r — Delete the sub-section A[l,r], add it to the end of B, and then sort B.

2 l r — Delete the sub-section B[l,r], add it to the end of A, and then sort A.

It is necessary to output the resulting arrays A,B.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Nextrix 2022-05-16 16:19:06 376 Initial revision (published)