0

I stumble on this question (https://atcoder.jp/contests/abc116/tasks/abc116_c) and I cannot for my life understand what the problem ask me to solve

So I understand these part: we have N flowers each flowers start at 0 heights we have sequences of heights that map to each flowers. I know there could be some sort of addition in here because on the third sample, I can see 96+50+75 = 221.

What I didn't understand what is the relation of these "l" and "r" to the problem? I know r should be equal to the number of flower but in the first output, "r" can be 3.

I just cannot understand the problem, even after looking up the answer, I still don't know why the answer like that.

1 Answers1

1

The $l$ and $r$ are indices. The input $(1,3)$ indicates that flowers number $1,2,3$ should be increased by $1$. If I instead input $(5,19)$, then flowers $5$ to $19$ are increased by $1$. So $r$ is not the number of flowers. Instead, if there are $n$ flowers, then we have to have $1 \leq l \leq r \leq n$.

user141592
  • 6,118
  • Thanks, I think I start to see it.

    So for sample first input output, they do

    • (1,3) so it will be "1 1 1 0"
    • then they do (2,4) to make it "1 2 2 1".

    and for the second input (1,5) then (1,1) twice then (3,4) then (4,4) assuming l and r can be less than or equal.

    The description of (l,r) in the problem might need little more explanation

    – sswastioyono18 Jan 30 '19 at 15:19