Скоро Codeforces Round 1133 (Div. 1, Div. 2)! Регистрация здесь. ×

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

Автор rb9, 11 лет назад, По-английски

I recently started learning dynamic programming, while solving some classical problems I encountered 2D range sum, and this which were solved using dp with inclusion and exclusion. Can anyone explain how can I tackle this types of problems? Any help will be appreciated.

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

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

To solve this problem, i search all posible squares and add to the solution. All this can be doing in O(n^3*logn) (if you search all intervals and then doing a binary search). You can see my code. By inclusion and exclusion, I dont know how to do it.