You are not logged in. Please login at www.codechef.com to post your questions!

×

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

asked 04 May '12, 19:37

vladamg98's gravatar image

4★vladamg98
395257
accept rate: 5%

edited 10 Jul '12, 13:13

admin's gravatar image

0★admin ♦♦
19.8k350498541

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) cyberax ♦3★
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) vladamg984★
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) mukulgupta4★

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

link

answered 11 May '12, 13:06

vipul4vb's gravatar image

2★vipul4vb
161
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) vladamg984★

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

link

answered 14 May '12, 20:25

betlista's gravatar image

3★betlista ♦♦
16.9k49115225
accept rate: 11%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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