Codeforces и Polygon могут быть недоступны в период с 6 декабря, 22:00 (МСК) по 7 декабря, 00:00 (МСК) в связи с проведением технических работ. ×

Just need hint for Problem C

Правка en2, от CandidFlakes, 2024-08-01 18:37:08

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!

Теги just give me some hints, wrong answer, debugging, greedy

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский CandidFlakes 2024-08-01 18:37:08 4 Tiny change: '889626).\nWhat I h' -> '889626).\n\n\nWhat I h'
en1 Английский CandidFlakes 2024-08-01 18:36:57 659 Initial revision (published)