How to solve spoj problem ADAZOO

Правка en1, от shoya, 2018-11-02 22:55:01

Problem link

Here is my approach :
- Calculate All pairs shortest distance using floyd Warshall for every pair of cell.
- Then dp[subset] = optimal answer for this subset.
- For each tyger u subset try to connect that with this subset in minimal way using pre-calculated shortest distances such that dp[subset u] = dp[subset] + min_dis.
- At last take sum for all subsets.

But this gives wrong answer. Please help.

Теги #spoj, #adazoo

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский shoya 2018-11-04 22:25:57 62
en1 Английский shoya 2018-11-02 22:55:01 667 Initial revision (published)