Блог пользователя Deepression

Автор Deepression, история, 6 часов назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится