Блог пользователя Shameek

Автор Shameek, 4 года назад, По-английски

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??

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

»
4 года назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

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 ).

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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!!