Getting a TLE during Submit (DEC18B::COMAS) but 0.01sec in my test Run


I am getting a TLE when I Submit my code for the Chef and Meatballs (COMAS) problem in the ongoing DEC18B contest.

However when I Run it within the Online IDE (with a grader function to replace the interactive inputs), I am getting 0.01 sec run-time for the maximum (1,000) test cases-- supposed to be the worst time. I even printed out the max. no. of queries, which is well within limits (N/2 + 4).

I am not sure what is causing the time limit to exceed the stipulated 1 sec !
Could I get some help ?

I am using Fortran (Gfortran 6.3) for my codes, which is itself a sparingly used language nowadays, but just thought if I could get some support from CodeChef on this !!

Here are my Submission Results.

Thanks in advance.

Looking at your submission results, I can see that you are getting TLE(-1.000), which most probably means that you are violating some conditions, i.e asking more than the allowed number of questions for some subtasks. Also check if you are flushing the output after printing each line.