April Fools' Day Contest 3 P4 - CCC '00 S4 - Golf (Hard)

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 1.0s
Memory limit: 1G

Author:
Problem type
Canadian Computing Competition: 2000 Stage 1, Senior #4

Roberta the Robot plays a perfect game of golf. When she hits the golf ball, it always goes exactly the distance that is specified for the club. Each such action is known as a stroke, and the object of golf is to hit the ball from the tee to the hole in the fewest number of strokes. Roberta needs a program to select the best combination of clubs to reach the hole in the fewest strokes. It is guaranteed that Roberta can get the ball from the tee to the hole. Roberta can carry up to 10^6 clubs, and the total distance from the tee to the hole does not exceed 10^9 metres.

Input Specification

The first line of input gives the distance from the tee to the hole, an integral number of metres between 1 and 10^9. The next line states the number of clubs, between 1 and 10^6. For each club, a line follows giving the distance, in metres, that the club will hit the ball, an integer between 1 and 10^9. No two clubs have the same distance.

Output Specification

If Roberta can get the ball from the tee to the hole, without passing the hole, print Roberta wins in n strokes. where n is minimized. It is guaranteed that Roberta can get the ball from the tee to the hole.

Sample Input

100
3
33
66
1

Sample Output

Roberta wins in 2 strokes.

Comments

There are no comments at the moment.