Shameek's blog

By Shameek, 5 years ago, In English

my code click here im getting runtime error (SIGSEGV) on 11th testcase..why? i have also increased the SIZE significantly as people were saying in the comment section that its more than 10^5.. i dont see a reason for long long as well in the question.. can someone please help??

  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

Hm. Is it correct?

    if (cc >= cnt)
        return query(u->l, v->l, lc->l, lcp->l, cnt, s, m);
    else
        return query(u->r, v->r, lc->r, lcp->r, cnt - cc, m + 1, e);

Seems the condition should be if( cc <= cnt ).

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

    feodorv i dont think so cc is the value in left tree cnt is value i need if left can give me what i want, i go towards left anyways will it pass upto case 10 with such a blunder? thanks for ur help!!