Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

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

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

Help me solve this problem please ->

**** **** There is an array of n elements, initially filled with zeros. You need to write a data structure that processes two types of queries: assign value v to all elements on the segment from l to r−1, find the sum on the segment from l to r−1.

Input

The first line contains two numbers n and m (1≤n, m≤100000), the size of the array and the number of operations. The following lines contain the description of the operations. The description of each operation is as follows: 1 l r v: assign value v to all elements on the segment from l to r−1 (0≤l<r≤n, 0≤v≤109). 2 l r: find the sum on the segment from l to r−1 (0≤l<r≤n).

Output

For each operation of the second type, print the corresponding value.

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

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

This title is ratism

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

    Title increased this blog's both <=1400 & >1400 click through count, But the problem is no one will post comments related to the question lol

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

i barley make the cut but it can be solved with a segment tree and btw its to early to learn it

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

    Please it's too hard for me to understand. Can you write the code or approach ? Also why is it early? Any help?

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

      its a advanced technique i think its too early for you to learn it

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

So you can't click on this blog, right?