I’m getting a tle , but i have tried to allot the table to every customer in O(1) time.
Please help me to optimize my code
the link for my solution :
http://www.codechef.com/viewsolution/4520187
You’re getting TLE because your else statement in while loop is reducing i by 1 which counter balance i++. It means every time else statement is executed, your i doesn’t modify resulting in infinite loop.
1 Like