JustAnAverageCoder123's blog

By JustAnAverageCoder123, history, 10 years ago, In English

Hi coders!

Can anyone help me out, how to solve this problem on SPOJ? Any help/hint is appreciated.

Have nice day!

»
10 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

https://en.wikipedia.org/wiki/Prim%27s_algorithm
I guess straightforward solution will work. Store also number of ways to reach certain vertex with minimal cost.

»
10 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

this problem sums up a hell lot of topics in graph theory and mathematics , misof wrote a solution to it on topcoder and I learnt from them (the problem and the solution) more than I learnt from any textbook or course