Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

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

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

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!

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

»
5 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by CandidFlakes (previous revision, new revision, compare).

»
47 минут назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

look at the tests

and I think you can look at the hints in the editorial