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

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

Hi everyone , i'm trying to solve this problem Link

I found some discussion in this forum in topcoder Link and they suggest a dp with bitmask.

Well i'm coded a dp with bitmask but i have got TLE

Someone can help me ?

My Implementation : Ideone

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

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

I'm really skeptical that this problem has a polynomial solution, so it's probably just about optimizing and pruning some type of backtracking.

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

Your solution is ok, but you have to change your dynamic programming by a backtrack to lose the constants of access to std::map, but you have to make some pruning to speed it up.