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

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

For the following problem 543A - Пишем код, the jury's solution 11035704 optimize the DP solution explained in the contest's editorial http://codeforces.net/blog/entry/17773.

I understood the approach explained in the editorial, but what's the intuition behind the optimization and how it works? Specially the lines with bitwise operations:

    int i = it & 1;
        ...
        z[i][j][k] = z[i ^ 1][j][k];
  ...
    ans += z[n & 1][bl][i];
  ...

Just to be clear: I'm not asking about the bitwise operations alone, but also how the original solution in the editorial translated to the jury's code. For example, if you maintain only the two last rows of the DP, how are you going to construct the problem's solution (output)? Thanks.

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

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

Auto comment: topic has been updated by marlonbymendes (previous revision, new revision, compare).

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

Auto comment: topic has been updated by marlonbymendes (previous revision, new revision, compare).