# Painters And Boards

Last Updated: 23 Feb, 2023
Medium
0/80
15 mins
85 %

## Problem Statement

#### Your task is to return the minimum time required to paint all the boards subject to the following conditions-

``````1. Any painter will only paint contiguous sections of the board.
For eg, A configuration where painter 1 paints boards 1 and 3 and not 2 is invalid.
2. A board cannot be painted partially by one painter, and partially by another.
``````
Detailed explanation ( Input/output format, Notes, Images )
##### Constraints:
``````1 <= T <= 100
1 <= A <= 10^5
1 <= B <= 10^9
1 <= N <= 10^3
1 <= Board[i] <=10^5

Time Limit: 1sec
``````
##### Sample Input 1 :
``````1
2 2 5
1 10
``````
##### Sample Output 1:
``````50
``````

#### Explanation for Sample 1:

``````For the first test case, there are two possibilities -

If painter 1 paints both the boards, the total time required will be 55.

If painter 1 paints boards 1 and painter 2 paints board 2, the total time will be max(5, 50) = 50.
So the minimum time required will be 50.
``````
##### Sample Input 2 :
``````1
4 10 1
1 8 11 3
``````
##### Sample Output 2 :
``````11
``````
Autocomplete
Console