Maximum sum problems

Revision en2, by hoang25, 2021-09-27 13:57:54

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$

and $A_i + A_j + A_k$ is maximum possible!

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

History

Revisions

Rev. Lang. By When Δ Comment
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)