Can anyone give an idea how to solve?

Revision en3, by Deepression, 2024-10-23 21:18:14

You are given an array of size N and must construct a deque by pushing each element one by one, either to the front or the back. You can push a total of K elements to the back and M elements to the front, with the constraint that M + K = N . Your goal is to determine the maximum number of index pairs (i, j) such that 2 *{deque}[i] > {deque}[j] and i < j. Constraints on N is 1e6.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Deepression 2024-10-23 21:18:14 26 Tiny change: ' and i < j' -> ' and i < j. Constraints on N is 1e6.'
en2 English Deepression 2024-10-23 21:16:43 0 (published)
en1 English Deepression 2024-10-23 21:16:25 393 Initial revision (saved to drafts)