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

Автор rofi93, история, 6 лет назад, По-английски

I was trying to solve this problem using AVL tree, but getting RE. Can't find out what I'm doing wrong. Can someone help me ??

Solution — https://ideone.com/l7a0jg

UPDATE

Got AC. The bug was I was accessing directly root->subtree_size without checking if the root is NOT NULL.

Here's my AVL tree implementation, pastebin and ideone

Полный текст и комментарии »

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

Автор rofi93, история, 7 лет назад, По-английски

Problem: You are given an array consisting of n elements and q queries in the form of [L,R]. You have to output the maximum occurrences of a number in the segment [L,R] for each query.

How to solve these kind of problems using Segment Tree ?? I can solve this using sqrt decomposition, but got stuck trying to solve using segment tree.

Полный текст и комментарии »

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

Автор rofi93, 9 лет назад, По-английски

In this problem 459B - Pashmak and Flowers range of n is 2*10^5 and i mistakenly declared the array of size 1*10^5. For this mistake i should have been given RE (Runtime Error), but instead why i was given TLE (Time Limit Exceeded) ? It took me a long time to figure out the bug because of weird verdict !! check my submissions- 13244700 and 13244705

Полный текст и комментарии »

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