N0V1CE's blog

By N0V1CE, history, 22 months ago, In English

Hi Everyone,

I am interested on problems on segment trees which have appeared in relatively new contests. I am asking this because I wish to learn segment trees and moreover the blogs which are 3-7 years old have a very few python submissions for the given problem. I am a user who submits in python and would like to know the problems from relatively new contests since at present there are more users who submit in python and their solution can work as stepping stones when I am practicing this data structure.

I tried using tags in the problem set but that doesn't help, so I decided to write a new blog. I request you to not put old blogs in the comment as very few of them have any python solutions.

Thank you very much for your help.

P.S. : By relatively knew I mean the period from 2021 may-present (1.5 / 2 years or so).

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

»
22 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I just solved 1779D - Boris and His Amazing Haircut from Hello 2023 (a contest that happened 2 days ago) using segment tree. Well, the main idea is greedy, and I simply manipulated the segment tree to store and look up information pertaining to whether hair within a range has been cut to the appropriate level. It can also be solved with a stack. My Python segment tree solution 188034835, and my Python stack solution 188037574. Also note that my segment tree uses an iterative implementation because time limits are tight with Python and the recursive version is sometimes too slow.