HOLI-SPOJ(graoh traversal 2)

i understood the logic of calculatin the max no of visits though a edge…but how it ensures there will be no friend in his hotel and one will reach the hotel of final configuration following the shortest path…basically i am not able to visualise what type of final configuration it will be

@kumar_sunny Basically in this problem we don’t have to worry that what will be configuration, we just need to ensure that

  1. All the people should go to one of the other people’s city. -> since we are sending some people from both sides to another so for all of them the cities are changed, and for remaining people we can think that they also have changed the cities by them by remaining on the same side.
  2. Two of them never go to the same city, because they are not willing to share a house. -> for this we are just not taking the cases when there are more than one people in the same house.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.