 # June challenge COVDSMPL question getting TLE with time = -1.00 sec

plz, tell me why was I getting -1.00 sec. if it was TLE with 1.01 sec then we know it is beyond the time limit but why -1.00 sec.

my code:

``````#include <iostream>
using namespace std;

int main() {
int t;
scanf("%d",&t);
int N,P,i,j,X;
int arr;
while(t--)
{

scanf("%d%d",&N,&P);

for(i=1;i<=N;i++)
{
int max=0;
for(j=1;j<=N;j++)
{
int al=1;
int r1=i,r2=i,c1=1,c2=j;
printf(" %d %d %d %d %d\n",al,r1,c1,r2,c2);
scanf("%d",&X);
if(X==-1)
_Exit(10);
else
{
if(X>max)
{
arr[i][j]=1;
max=X;
}
else
arr[i][j]=0;

}
}
}
printf("2\n");

for(i=1;i<=N;i++)
{
for(j=1;j<=N;j++)
{
printf("%d ",arr[i][j]);
}
printf("\n");
}
scanf("%d",&X);
if(X==-1)
_Exit(0);
}

return 0;
}``````

TLE(-1.0000) means that your idle time limit is exceeded

you are not taking input/ giving output at the right time intervals

yes you are right it means that but if you see my code i am taking and giving all the input and output.please if you see my code and tell me where I went wrong it would be a great help. actually i don’t code in C++ (I’m beginner and just started CS in school )
so, i won’t be of much help there sorry

You aren’t flushing your output. Try to use fflush(stdout) after every query and before taking any input.

1 Like

bro ,you are printing a space before %d after the line int r1=i,r2=i,c1=1,c2=j, u should start with a number.

1 Like

This isn’t necessary.

i started with a no at first but i thought of this but both were having same result.I am really confused bro.

One more thing that I found was u have declared int arr,
and since it is 0 based index, U should have declared arr. And why exit_(10) and not 0,
By the way ,even if you correct tle, you will get wa, because your 1st element of each row isnt necessarily correct.