Bargain or No Bargain
Time limit1sMemory limit128 MB
Given prize values and a budget M, decide whether optimal play maximizing expected log utility yields expected prize money above M.
- Level
Medium7 of 10
- Topics
- Dynamic programming, Probability, Math, Recursion
- Solved
- No attempts yet
Problem
The NZPC Entertainment Division has planned a new TV game show called "Bargain or No Bargain". In the show there are several briefcases, each containing a cheque for a fixed amount of prize money. The list of prize values (one per briefcase) is announced in advance, but nobody knows which briefcase holds which prize. A single contestant is handed one briefcase without learning its contents.
The game is played in a series of rounds. In every round (including the first), the NZPC Bank first makes the contestant a cash offer, which the contestant may accept in order to quit the game immediately, forfeiting the contents of their own briefcase. If the contestant declines, they then open one of the remaining closed briefcases, revealing its prize and thereby eliminating the possibility that this prize is in their own briefcase. Play continues until either the contestant accepts an offer, or every briefcase except the contestant's has been opened. In the latter case the contestant's briefcase is opened and they leave with the cheque it contains.
Game details:
- Let be the sum of the remaining prizes and the number of remaining prizes. The bank offer is always .
- Each briefcase is equally likely to contain each of the remaining prizes.
- The contestant plays optimally to maximize the expected value of , where is the utility of winning dollars (the natural logarithm). This concave utility models the fact that a fixed increase in wealth is worth less when you already have more money.
Given a set of prize values, decide whether a contestant playing optimally would, on average, win more than a given amount of prize money. The optimal strategy maximizes the expected utility; the quantity compared against is the resulting expected prize money in dollars.
Input
The input consists of several game scenarios. Each scenario is given on two lines. The first line lists the dollar values of the prizes, separated by single spaces; every prize value is a positive integer. The second line contains a single positive integer , the largest expected prize money per game (under optimal play, as defined above) that the NZPC can afford. Each scenario has at most 25 prizes, and prize values may repeat.
Output
For each game scenario, if the expected prize money per game under optimal play is greater than , print UNACCEPTABLE on a line by itself; otherwise print OK on a line by itself. The input is terminated by a line containing only -1, which must not be processed.