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


Please help me understand the ForbiddenSum problem.

Hi fellas. I am having tough time understanding the solution to this problem. It has a editorial. Although from editorial approach is quite clear, but when I try to read the code of the author, I don't quite understand it. Points I specifically don't understand in the authors solution are following:

  1. How is the segment tree being constructed.
  2. What is the purpose of the "Root" array.
  3. And in the "rect" function, why "res" is chosen that way. I mean like upper_bound function of C++.

Other quite good/readable solution, I found was of the user @deneo, here, he also did the same thing. Please help me!!!


asked 05 Jan '15, 01:14

paramvi's gravatar image

accept rate: 0%

This question can violate the rules of ongoing contest. Hence, we cannot help you. But try doing some hand-work, and construct the segment tree and apply the approach. You'll get it else you'll have to wait till the contest ends. :)

(05 Jan '15, 18:49) damn_me3★

I get it. yea sure, I guess I have to try bit harder.

(05 Jan '15, 20:54) paramvi3★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 05 Jan '15, 01:14

question was seen: 1,065 times

last updated: 05 Jan '15, 20:54