P2933 [USACO09JAN] The Baric Bovine G
Description
Following up on a journal article about increasing milk production, Bessie has become the Baric Bovine by studying atmospheric pressure in order to curry favor with Farmer John.
She takes N (1
Input Format
\* Line 1: Two space-separated integers: N and E
\* Lines 2..N+1: Line i+1 contains a single integer: M\_i
Output Format
\* Line 1: Two space-separated integers: the size of the smallest subset of measurements that produces an error of at most E and the least possible error for the subset of that size.
Explanation/Hint
Bessie takes four measurements; the maximum error is 20. The
measurements are, in sequence: 10, 3, 20, and 40.
Choosing the second and fourth measurements is the best option, giving an error of 17. The first term's error is 2\*|10-3| = 14; the third term's error is |2\*20 - (3+40)| = 3.