Is my Approach wrong?

Revision en2, by TTMMM, 2019-12-10 14:10:24

Submission ID: 66585414 Problem : 1201/C C. Maximum Median

I am first calculating that for median to be ar[i], can we go there by swapping? Once done, all elements in second half of array are equal and i am still left with k, its easy to increase median by increasing all elements by 1 each. Please tell if this approach is fine or not, Getting WA at test case 6

Tags median, #binary search, #greedy, #implementation, 1500, #constructive algorithms

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English TTMMM 2019-12-10 14:10:24 3
en1 English TTMMM 2019-12-10 14:09:57 390 Initial revision (published)