ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

prob 1087
Posted by asif 24 Mar 2001 17:55
What is meant by a perfect game?And,also please anyone give
me a clue for this problem.I used DP.But got Wrong answer.
                                              Asif.
Re: prob 1087 (by the way, there are specialized webboards for each of the problems)
Posted by Ilya Semenov (NSU) 25 Mar 2001 14:17
> What is meant by a perfect game?And,also please anyone
give
> me a clue for this problem.I used DP.But got Wrong answer.
>                                               Asif.


?????
it's one of the easiest problem here.
it took me 3 minutes to code & check, AC from the first try.

it's classical recursive deeping/dynamic programming.
lets consider a function "bool result(int N)" which
returns 'true' if current player would win having N stones,
and 'false' if he wouldn't.
so, if N==0, current player loses; otherwise he wins if
there exists at least one i such as other player (adversary
of the current player) loses with N-K_i stones.
(I omit various checkings, dynamic saving of resulsts,
etc.)

P.S. It surely can be solved only by dynamic programming
with no recursion at all, but I think the solution would be
somewhat more complicated.