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

×

Discrepancies in the Voters List

my code is giving me time limit exceeded.....please help here is my code http://www.codechef.com/viewsolution/4304786

asked 12 Jul '14, 10:07

harry_potter's gravatar image

2★harry_potter
131222
accept rate: 0%


Consider simple case :

50000 50000 50000

1 4 7 10 13 16 ...

2 5 8 11 14 17 ...

3 6 9 12 15 18 ...

Then first part of your code takes 25*10^8 (N^2).

Second part again N^2.

So you will definitely get TLE. This has an O(NlogN) and a O(N) solution.

link

answered 12 Jul '14, 11:19

yash_15's gravatar image

5★yash_15
5181716
accept rate: 2%

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:

×205
×40
×38

question asked: 12 Jul '14, 10:07

question was seen: 1,085 times

last updated: 12 Jul '14, 11:19