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

×

CSUBQ november challange

https://www.codechef.com/problems/CSUBQ here the link to the question. so here's what I did.....for each query I calculated for R and then for L and the difference of both is what I got as an answer. for each query, it is taking O(4*n) =~ O(n). but this only fetches me 25 points. here's the link to code https://ideone.com/Pp9YtZ

asked 29 Nov '17, 11:34

mohit9999's gravatar image

1★mohit9999
193
accept rate: 0%

you said for each query O(n) and there are q queries so, O(qn) which didn't pass! so, what was wrong here?

(29 Nov '17, 13:50) pk3012★

Wow! That sounds fishy. I observed your code. Your solution takes exactly O(n * Q), so forcedly it fetched ya 25 points. Ya gotta read author's solutions in codechef's discussion. Tryna use BIT and heap to solve it again! Good luck to ya.

link

answered 29 Nov '17, 14:54

dahaodl's gravatar image

3★dahaodl
11
accept rate: 0%

edited 29 Nov '17, 19:55

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:

×858
×67
×16

question asked: 29 Nov '17, 11:34

question was seen: 377 times

last updated: 29 Nov '17, 19:55