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

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

I get to encounter problems of this kind and when I think that their solution is using dp, either the given value of n turns out to be too large or one of the operations consumes too many recursive function calls. Is there any general way to solve such problems or initial approach one should start thinking?

  1. Codeforces Problem 1485A
  2. Add and Divide This problem is of 30-day February 2021 challenge Week 3. Requires login to view problem.
  3. SPOJ MST1 This problem has n<=1e7, i.e. can be solved using O(n) dp but what if n was upto 1e9 like in this problem.

I also thought of using BFS as it can give me the minimum number of steps to reach the goal but it did not work in general.

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

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

In CP there's no such thing as a "general way to solve problems". Each problem has its own idea which you need to find. By practicing (and only practicing), finding it becomes easier.