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

×

please help with time complexity

Can anyone please explain me why first code https://www.codechef.com/viewsolution/21531950 gets TLE while the second one https://www.codechef.com/viewsolution/21531975 doesn't. The only difference between them is in loop condition. In first its (i*i)<=d while in second its i<=(d/i).

asked 08 Nov, 09:57

sparsh_garg's gravatar image

4★sparsh_garg
102
accept rate: 0%

3

Overflow?
Try long long.

(08 Nov, 12:02) aryanc4036★
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:

×78

question asked: 08 Nov, 09:57

question was seen: 108 times

last updated: 08 Nov, 12:04