Why is my O((2^P)*P) time solution giving TLE in testcase 2?

Правка en1, от VIKRAM91, 2018-10-08 15:03:56

Recently I did a Gym competition as a virtual contest. I was not able to do Problem D. Largest Group. After completion of the contest, I tried to implement the editorial solution of this given problem. The editorialist is saying that a solution of time complexity O((2^P)*P) will pass. But my solution is giving TLE in test case 2.

Why is my code giving TLE? Is there any other good solution for this problem?

This is my code which I implemented as said in editoiral.

Теги bit-masking, #gym, #graph, #c++

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский VIKRAM91 2018-10-08 15:03:56 688 Initial revision (published)