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

Автор 123gjweq2, история, 8 месяцев назад, По-английски

Hello. I can't seem to figure out this problem's solution. I've read the editorial and I understand the first part but when the author says:

"To further optimize this solution, another transformation is needed. Ideally, we would like each ai to contribute to the answer independently of other values. And this can almost be achieved. Notice that the maximum returns 0 only if ai<ai−1 for any k, not just for k=1. This may require proof, but it is quite obvious."

I just don't get what this means. I also don't know what he's tryna do with the ci coefficient. I'd really appreciate it if someone here could explain it to me.

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

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

In second option (last paragraph of editorial) $$$c_i$$$ is similar to what I did in my solution: https://codeforces.net/blog/entry/128421?#comment-1140048 but from slightly different angle.

»
7 месяцев назад, # |
Rev. 3   Проголосовать: нравится +5 Проголосовать: не нравится

After much deliberation, I finally figured it out. I learned a lot too. I am going to write down what I have learned so that I can reference it if I ever need to. Maybe someone else might find it helpful too.

explanation
$O(n \cdot \sqrt A)$ submission
$O(n + A\cdot\log A)$ solution
  • »
    »
    6 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    OMG, cp is hard, i'm giving up

    • »
      »
      »
      6 месяцев назад, # ^ |
      Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

      Wow, thanks for reminding me about this comment. I just figured out how to use latex so imma prettify it.

      edit: well... I tried my best. At least now I know why authors only use 1 letter to name arrays.