Given 2 integers A and B and an array of integers C of size N. Element C[i] represents the length of ith board.
You have to paint all N boards [C0, C1, C2, C3 … CN-1]. There are A painters available and each of them takes B units of time to paint 1 unit of the board.
1. 2 painters cannot share a board to paint. That is to say, a board cannot be painted partially by one painter, and partially by another.
2. A painter will only paint contiguous boards. This means a configuration where painter 1 paints boards 1 and 3 but not 2 is invalid.
Return the ans % 10000003.
1 <= A <= 1000
1 <= B <= 106
1 <= N <= 105
1 <= C[i] <= 106
The first argument given is the integer A.
The second argument given is the integer B.
The third argument given is the integer array C.
Return minimum time required to paint all boards under the constraints that any painter will only paint contiguous sections of board % 10000003.
A = 2 B = 5 C = [1, 10]
A = 10 B = 1 C = [1, 8, 11, 3]
Possibility 1:- One painter paints both blocks, time taken = 55 units. Possibility 2:- Painter 1 paints block 1, painter 2 paints block 2, time take = max(5, 50) = 50 There are no other distinct ways to paint boards. ans = 50 % 10000003
Each block is painted by a painter so, Painter 1 paints block 1, painter 2 paints block 2, painter 3 paints block 3 and painter 4 paints block 4, time taken = max(1, 8, 11, 3) = 11 ans = 11 % 10000003
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.