Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

A weird segment tree problem

Правка en1, от rakkoon69, 2022-07-16 13:13:54

Given an array of n integers equal to zero. There are 3 type of queries:

  1. Increase all elements from l to r by 1
  2. Decrease all elements from l to r by 1
  3. Count the number of zeros from l to r

Is there an efficient way to solve this problem in O(N log N), O(N sqrt(N)) or at least O(N log2 N)? Thank you in advance!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский rakkoon69 2023-10-03 19:41:46 138 Tiny change: '26468052] ' -> '26468052] (The STree namespace)'
en1 Английский rakkoon69 2022-07-16 13:13:54 357 Initial revision (published)