#T505. 【USACO2.1】健康的荷斯坦奶牛
【USACO2.1】健康的荷斯坦奶牛
Description
Farmer JOHN takes pride in having the healthiest cows in the world. He knows the minimum amounts of each vitamin required for his cows. Please help Farmer JOHN feed his cows to maintain their health while using the fewest types of feed possible.
Given the minimum vitamin requirements for the cows, output which types of feed should be given to the cows, ensuring the smallest number of feed types is used.
Vitamin amounts are represented as integers, and each type of feed can be used at most once for the cows. The data guarantees a solution exists.
Input Format
Line 1: An integer V (1 ≤ V ≤ 25), representing the number of vitamin types required.
Line 2: V integers (1 ≤ each integer ≤ 1000), indicating the minimum daily requirement of each vitamin for the cows.
Line 3: An integer G (1 ≤ G ≤ 15), representing the number of feed types available for feeding the cows.
The following G lines: The nth line describes the amounts of various vitamins contained in the feed numbered n.
Output Format
The output file consists of a single line, including the smallest number of feed types P required by the cows.
This is followed by P numbers, representing the selected feed indices (listed in ascending order).
If there are multiple solutions, output the one with the smallest lexicographical order (i.e., the smallest sequence of indices).
```input1 4 100 200 300 400 3 50 50 50 50 200 300 200 300 900 150 389 399 ``` ```output1 2 1 3 ``` ## Hint【Data Range】
For 100% of the data, 1 ≤ v ≤ 25, 1 ≤ g ≤ 15.
All input integers are within the range of [1, 1000].
Source
USACO 2.1