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


help required in spoj problem KGSS

Can someone please help me with this problem from spoj on segment trees. I am storing maximum and second maximum element at each node of tree but getting wrong answer. Here is my code. Any help is appreciated.:)

This question is marked "community wiki".

asked 19 May '18, 21:09

pavitra_ag's gravatar image

accept rate: 5%

wikified 20 May '18, 14:33

There is a small mistake. The update operation "sets the value of A[i] to x", not to max(A[i], x).


answered 20 May '18, 16:23

meooow's gravatar image

6★meooow ♦
accept rate: 48%

Thanks man! Helped a lot :)

(20 May '18, 19:46) pavitra_ag4★
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: 19 May '18, 21:09

question was seen: 124 times

last updated: 20 May '18, 19:46