문제
Problem 3: Mooo Moo [silver] [Brian Dean, 2014]
FJ's N fields
입력
* Line 1: The integers N and B.
* Lines 2..1+B: Line i+1 contains the integer V(i).
* Lines 2+B..1+B+N: Line 1+B+i contains the total volume of all mooing in field i.
출력
* Line 1: The minimum number of cows owned by FJ, or -1 if there is no configuration of cows consistent with the input.
예제1
52
5
7
0
17
16
20
19
4
Input Details
FJ owns 5 fields, with mooing volumes 0,17,16,20,19. There are two breeds of cows; the first moos at a volume of 5, and the other at a volume of 7.
Output Details
There are 2 cows of breed #1 and 1 cow of breed #2 in field 2, and there is another cow of breed #1 in field 4.