orlon.'s blog

By orlon., history, 6 years ago, In English

I was trying out segment tree problems and had some confusions in understanding the solutions for problems involving segment tree with offline queries.

Here are two problems GQR and 301D - Yaroslav and Divisors, for which I was referring to solutions GQR_AC and 36281412 respectively.

If anyone could help me understand these solutions in detail, it would be a great help.

Thanks!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By orlon., history, 6 years ago, In English

The problem is GSS1 and my solution is very close to AC but I just can't seem to find why my code gives SIGSEGV segmentation fault on G4G IDE. I request you to take a quick look at the code and let me know, it will be a big help! Thanks a lot!

PS- I used segment tree to store sum, maximum prefix sum, maximum suffix sum and maximum subarray sum in a segment.

Edit:- Nevermind, I found the mistake. I was initialising a node with all four variable values as LLONG_MIN which should't have been done because adding a negative number to that will cause overflow. Also, in build function I forgot the start>end case.

Full text and comments »

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

By orlon., history, 6 years ago, In English

Hi guys! I was wondering if this problem:- https://www.codechef.com/problems/BITMASK4 can be solved using DFS within the time constraints. Any help will be appreciated. Thanks you!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it