Maximum sum problems

Правка en1, от hoang25, 2021-09-27 13:24:27

Hello!

Today I have a problem. After a while, the problem turned into finding 3 elements with indice $$$i, j, k$$$ in an array $$$A$$$ of size $$$n$$$ that:

  • $$$1 ≤ i < j < k ≤ n$$$
  • $$$2 * j = i + k$$$
  • $$$n ≤ 2*10^5$$$
  • $$$A_i ≤ 10^9$$$

I wonder if the problem can be solved in a way better than the naive $$$O(n ^ 2)$$$ solution. Thank guys!

Теги array, maximum sum

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский hoang25 2021-09-27 13:57:54 46 Tiny change: ' ≤ 10^9$\nand $a_i + a_j + a_k$ is max' -> ' ≤ 10^9$\n\nand $A_i + A_j + A_k$ is max'
en1 Английский hoang25 2021-09-27 13:24:27 348 Initial revision (published)