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

×

query regarding execution time.

suppose size of input could be n=1...100000 and complexity of my code is O(n3). will it be able to execute in 2 sec.

asked 28 May '16, 00:05

arpit728's gravatar image

2★arpit728
651530
accept rate: 12%


Generally you can do 10^7 to 10^8 calculations per second in any competitive platform.

In your case n will get max value of 10^5 so it require approx. 10^15 calculations.

so it will definitely exceed time limit of 2 seconds (It will exceed time limit of 1000 seconds).

I think you should make solution having time complexity of O(nlogn).

link

answered 28 May '16, 02:28

dhavalmehta's gravatar image

4★dhavalmehta
563
accept rate: 30%

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:

×568
×199
×141
×20

question asked: 28 May '16, 00:05

question was seen: 527 times

last updated: 28 May '16, 02:28