### CandidFlakes's blog

By CandidFlakes, history, 3 days ago,

This is the problem. This is my WA attempt.

What I have observed is that a maximum of (n/2-1) maxima is possible for an array of size n, where n is even. So initially I created another array q such that the final array a = p+q , has all elements equal. Then I greedily tried to create (n/2-1) maximas by swapping the elements of array q( In the code it's ans array). I am willing to explain more if clarification is needed. Please just give me the hint, I want to solve it myself.

I will be thankful for any help!

• +4

 » 3 days ago, # |   0 .ComplaintFrame { display: inline-block; position: absolute; top: 0; right: -1.4em; } .ComplaintFrame a { text-decoration: none; color: #ff8c00; opacity: 0.5; } .ComplaintFrame a:hover { opacity: 1; } ._ComplaintFrame_popup p, ._ComplaintFrame_popup button { margin-top: 1rem; } ._ComplaintFrame_popup input[type=submit] { padding: 0.25rem 2rem; } ._ComplaintFrame_popup ul { margin-top: 1em !important; margin-bottom: 1em !important; } Auto comment: topic has been updated by CandidFlakes (previous revision, new revision, compare).
 » 3 days ago, # | ← Rev. 2 →   0 look at the testsand I think you can look at the hints in the editorial
•  » » 46 hours ago, # ^ |   0 Thanks so much for reply!
 » 2 days ago, # |   0 Quick hint/intuition: Indices of all local maximas in an optimal arrangement should have the same parity.
•  » » 47 hours ago, # ^ |   0 Thanks so much for the hint! Isn't an arrangement like this possible-> https://www.autodraw.com/share/KIJY909STG3I ?
•  » » 45 hours ago, # ^ |   0 Although I was able to AC, but I still don't understand why don't we consider the case — https://www.autodraw.com/share/KIJY909STG3I ?