Wrote the code correctly but it is not accepting

for the problem Alice Potter And Dumbledore Army in feb cook off ,i wrote the optimal code but it is giving tle but for some other person it got accepted my solution id is 88708807…what should i do now…

2 Likes

Same problem

The same problem happened with me today I tried 4th question in too many different ways but couldn’t get it accepted. And after completion of the contest I checked some other submissions which were exactly same and they got accepted. Code is here CodeChef: Practical coding for everyone

1 Like

@ksiva7393
Adding this line at starting of main fixes this
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);

It still takes 1.47 sec

If you replace endl by “\n” , it will run in 0.24 sec . Thats too much reduction .

1 Like