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

Автор parth_15, история, 6 лет назад, По-английски

Hello all. I know that ternary search can be applied when function is monotonic and can be used to find maximum/minimum value of function. But, for some problems that can be solved with it, how to prove that it is monotonic. Is there any general technique or you only visualize by graph.

For ex: I was solving problem and making graph of it, I get some idea that it is decreasing and then increasing but I can't prove it strictly. In the editorial, they mentioned that f+g is monotonic if f is strictly increasing and g is strictly decreasing. I am also not able to get that proof and I asked on stackexachange and the answer was it was not true. Then how it is proved in editorial. Can someone help with this questions? Thanks in advance.

Полный текст и комментарии »

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

Автор parth_15, история, 7 лет назад, По-английски

Hello everyone, I was solving this problem but I am constantly getting WASubmission. I have used greedy approach. I first sorted the array and started checking from right to left that if we can find pair for ith index,then match up. Treeset is used for that purpose. But I am not able to find any bug. Please help.

Полный текст и комментарии »

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

Автор parth_15, история, 7 лет назад, По-английски

Hello, I was solving a problem PROBLEMfrom this long challenge but my solution Solutionis not getting accepted. I have used 2 colouring graph method for vertices whose difference is 1 and DSU for vertices whose difference is 0. Please have a look at the solution and tell that is approach correct or not?

Полный текст и комментарии »

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