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

Автор code_warrior, история, 4 года назад, По-английски

Hello,guys! I tried to solve the problem candies distribution of codeforces. But, i don't know why it is giving wrong answer on test 67. My idea is to find the highest element in each iteration (because the highest element will have no element greater then it in its left or right sides, So l[i]=r[i]=0.) and the allocate the val (initially val=n) to all such positions and subtract their contribution from every position accordingly and then do val--. Although the editorials approach is different from mine, I will be happy to know where am i wrong or my idea is not correct. This is the problem

My code

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