sajalhsn13's blog

By sajalhsn13, history, 7 years ago, In English

i don't know what is wrong with my idea. I tried many times but still wrong answer. can anyone tell me what is wrong?

source : http://www.spoj.com/problems/GSS2/

code: https://paste.ofcode.org/32Kc7W5baENjJqs2ckLYFwq

  • Vote: I like it
  • -9
  • Vote: I do not like it

| Write comment?
»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I can't see how you handled the idea of removing duplicates. I solved it using a offline approach. Quora has a nice tutorial on it.

It is harder than GSS3, GSS4 and GSS5. Maybe you want to try them first if you are going to solve them all.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i also use offline. i sort the queries wrt right position. if any value appear previously I set 0 at the previous position of the segment tree, and insert the value at the current position. then i use GSS1.