×

# DIVPAIR: Getting tle

 1 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 asked 04 May '12, 19:37 395●2●5●7 accept rate: 5% 0★admin ♦♦ 19.8k●350●498●541 1 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. (04 May '12, 22:24) 1 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 } (04 May '12, 23:02) 1 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. (12 May '12, 21:27)

 1 If you share your code from IdeOne.com, we can offer a hand of help. or you can wait for tournament to get over. answered 11 May '12, 13:06 2★vipul4vb 16●1 accept rate: 0% 1 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) (11 May '12, 15:50)
 1 Maybe I'm doing something wrong, but your code returns 0 for n = 3 and m = 5, but 2+3=5... answered 14 May '12, 20:25 16.9k●49●115●225 accept rate: 11%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×2,736
×727
×59

question asked: 04 May '12, 19:37

question was seen: 1,999 times

last updated: 10 Jul '12, 13:13