What Algorithm needed to use to solve this problem ?
Algorithm like Max Flow ?? I am not sure about ..
1664 - Conquer a New Region
Moderator: Board moderators
-
- Learning poster
- Posts: 96
- Joined: Tue Apr 23, 2013 12:54 pm
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 1664 - Conquer a New Region
It is similar to Kruskal's algorithm, but you'll need to add some logic to how you implement the union.
Check input and AC output for thousands of problems on uDebug!
-
- Learning poster
- Posts: 96
- Joined: Tue Apr 23, 2013 12:54 pm
Re: 1664 - Conquer a New Region
Yes , Kruskal and Condition to choose which one to be parent of other .... Trick to solve this problem .
WA? Use long long
Happy Coding ,, And thanks Brainfry
But in case of running time , my time is far far greater than you...
How do you implement kruskal algorithm ?? Brainfry
WA? Use long long
![:D](./images/smilies/icon_biggrin.gif)
Happy Coding ,, And thanks Brainfry
But in case of running time , my time is far far greater than you...
![:)](./images/smilies/icon_smile.gif)