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

×

does TLE solution gives correct answer?

I was doing a problem in Codechef and when I submit my solution it shows "Time Limit Exceed", I am wondering if my solution is correct and I just have to optimise it OR it could be wrong?

asked 08 Oct '14, 09:31

mskanyal's gravatar image

2★mskanyal
101137
accept rate: 0%

1
(08 Oct '14, 21:08) betlista ♦♦3★

Not necessarily. TLE means your code couldn't provide an output in the specified time limit. After you optimize your code and manage to produce an output within the given time limit then only Chef can match your answer with his output file to check whether your answer is correct or not.

link

answered 08 Oct '14, 13:25

xiaoyu_02's gravatar image

2★xiaoyu_02
5531923
accept rate: 5%

It could be wrong.

link

answered 08 Oct '14, 10:10

neo1tech9_7's gravatar image

6★neo1tech9_7
8.5k51538
accept rate: 19%

Answer is hidden as author is suspended. Click here to view.

answered 24 Feb '17, 18:16

davidwarren's gravatar image

0★davidwarren
(suspended)
accept rate: 0%

edited 24 Feb '17, 18:17

It could be wrong. You have no guatantee on the outcome, after optimization, you can have a good answer, a wrong answer, or even a runtime error.

link

answered 24 Feb '17, 20:12

douss's gravatar image

2★douss
1
accept rate: 0%

edited 24 Feb '17, 20:13

It is possible that your solution to the problem was right,or it could be wrong but surely it was not acceptable because its time complexity or the time taken to run the code was more than the time limit specified by the problem setter. If TLE is coming that means , you have to come up with an alternative solution, you have to think in a different manner than you were thinking previously. Thinking in a step by step manner will increase your deductive skills. I hope it helps.

link

answered 04 Mar '17, 16:28

thesilentnoise's gravatar image

2★thesilentnoise
26
accept rate: 20%

TLE simply reflects that your code is not optimised enough as per requirement, it can be correct but time constraint is not being fulfilled.

link

answered 05 Mar '17, 00:02

anmolmishra's gravatar image

2★anmolmishra
132
accept rate: 0%

No, TLE (Time Limit Exceeded) doesn't necessarily give the correct answer. It just states that your program execution has exceeded the time limit specified in the question, after which neither Codechef nor any Online Judge bother to check whether your solution is correct or not.

Online judges follow the 'AND' condition when they run the program. This means that even if one of the conditions they mean to check is false, they terminate the execution without checking the next condition. The order is something like this:-

1)Check compilation (Compilation Error)

2)Check whether there are any runtime errors (NZEC)

3)Check whether the program has given an output within the time limit (TLE)

And if your program successfully passes these tests,

4)Check whether the output(s) obtained matches with the output(s) in their list or not (AC/WA)

The only way to check whether your program is effecive (but not efficient) is to run and test it on any IDE(offline) or http://ideone.com/ (online) for random inputs. Obviously, your program won't work for large inputs, as they were the cause of the TLE.

I hope it helped :)

link

answered 05 Mar '17, 07:13

akashbhalotia's gravatar image

5★akashbhalotia
865214
accept rate: 10%

edited 05 Mar '17, 07:18

It is not necessary.

TLE just means that your code ran out of time before it can completely execute.

link

answered 05 Mar '17, 20:31

tushkitripathi's gravatar image

0★tushkitripathi
28318
accept rate: 5%

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:

×856
×729
×340

question asked: 08 Oct '14, 09:31

question was seen: 1,761 times

last updated: 29 Aug '17, 11:28