Chef and strange matrix (chefbm)

the p commands will always be in increasing order right ?
or is it possible that some input can be like this one also

4 4 6

2 2

3 2

2 3

4 3

4 4

3 1

1 Like

the i and j can be in any order but the value of i and j must follow the constraints :slight_smile:

1 Like

It can be in any order this was just clarifying the problem statement no more questions will be answered during live contests.
P.S. Please do not post questions during ongoing contests

please clarify

if as per constraints 1 ≤ n, m. then if m and n both are 1. then how cost can be calculated through a(i)(j) - a(i)(j - 1).

1 Like

I think its a pretty good question. Problem setters should look into this edge case.

There is nothing special in this case, please do not create problems, where no problem is, read the problem statement properly…

thnx :slight_smile: the problem statement is bit confusing that why i asked this clarifying question.

//