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

×

How to determine if my program is gonna give TLE ??

I have recently tried solving the questions in the long challenge, in the greedy candidates questions I tried implementing it in java and got 2.1s and TLE, how to understand why it gave TLE and how to overcome it??

asked 19 Aug '17, 18:40

x_blitz_x's gravatar image

1★x_blitz_x
205
accept rate: 0%


Dont use scanner class for taking input. In that 2 second time, I bet that a huge chunk of your time is taken in just taking input. Google and copy the Fast I/O template of java, and re-run the same code.

link

answered 19 Aug '17, 18:48

vijju123's gravatar image

5★vijju123 ♦♦
15.5k12066
accept rate: 18%

edited 19 Aug '17, 18:49

thanks a lot!

(19 Aug '17, 19:21) x_blitz_x1★

Use Buffer Reader or any other fast I/O template for taking input.
Also, in case you didn't know about time complexity, this link will be helpful!

link

answered 19 Aug '17, 18:58

dishant_18's gravatar image

4★dishant_18
61419
accept rate: 12%

edited 19 Aug '17, 18:58

thanks a lot!

(19 Aug '17, 19:21) x_blitz_x1★
Answer is hidden as author is suspended. Click here to view.

answered 19 Aug '17, 19:11

raj79's gravatar image

2★raj79
(suspended)
accept rate: 10%

thanks a lot!

(19 Aug '17, 19:21) x_blitz_x1★

I found an answer for this question in detail here

I hope you will find it helpful.

link

answered 19 Aug '17, 20:23

adnanli's gravatar image

2★adnanli
241
accept rate: 33%

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
×1,424
×727
×205
×193

question asked: 19 Aug '17, 18:40

question was seen: 384 times

last updated: 19 Aug '17, 20:23