DIVPAIR: Getting tle

My code is correct, it’s working for 0,1 sec for
100000
100000000 1(and that 100000 times)
and that code is giving TLE here, I don’t know why.
Can someone see my code and tell me what’s wrong (with input/output) probably, it will be oka if it’s wrong answer, but i don’ know why TLE???
Code: http://www.codechef.com/viewsolution/1012872

1 Like

your code won’t be visible to us until the contest has ended. so we can’t help you for now. you should generate realistic test cases locally, to get a better idea why your code is getting TLE.

1 Like

I taught that admins can see the code, but my code is like:
I have one function
int a(int x,int y, int z)
{
return x(4x+3y+2*z); //Its not that ofc but sth like that
}
int main()
{
while(T–)
input m,n;
print a(m,n,m)-a(n,m,n);
return 0;
I think its O(1) and i dont know how that can be tle, i tried in C# and C++ and its same =.= its working fine on ideone.com
}

1 Like

If you share your code from IdeOne.com, we can offer a hand of help. or you can wait for tournament to get over.

1 Like

http://ideone.com/CUSk7 It’s the code, ideone can’t take that big input but its working fine 100% on biggest input it can take it’s working for 0.02 sec You can see the code it’s O(1)

1 Like

Time limit was strict. Too many division and modulo operations could be the main reason for time out.
Also don’t use long long unless it is totally necessary. Inputting long long takes more time than inputting an int.

1 Like

Maybe I’m doing something wrong, but your code returns 0 for n = 3 and m = 5, but 2+3=5…

1 Like