Getting TLE for TYTACTIC even after using BIT(Fenwick Tree)

I have used fenwick tree to solve the TYTACTIC question but I’m still getting TLE! My solution link

I found 1 error in your code, edges given do not necessarily mean u is immediate superior of v (check problem statement).
Also long is not needed here, since skill levels are limited by 20000, so the maximum sum in bit would be 2*109 which easily fits in int. I submitted your code after changing these and got AC in 0.06. Your AC code

2 Likes

thanks for help :slight_smile: