Function to return lcm of two numbers
int lcm ( int a , int b ) { return ( a * b ) / ( __gcd ( a , b ) ) ; } int dfs ( int src , vector < int > adj [ ] , vector < bool > & visited ) { visited [ src ] = true ; int count = 1 ; for ( int i = 0 ; i < adj [ src ] . size ( ) ; i ++ ) if ( ! visited [ adj [ src ] [ i ] ] ) count += dfs ( adj [ src ] [ i ] , adj , visited ) ; return count ; } int findMinTime ( int arr [ ] , int P [ ] , int n ) {