算法竞赛入门典习题章.pdf
FFantasyCricket
ICCWorldCup2011hasjustfinished.Duringtheworldcup,lotsofcricketfanswereplayingan
onlinegamenamedFantasyCricket.
Thescoreboardoffantasycricketlookslikethefollowingimage.Aftereachmatchoftheworldcup
thescoreboardoffantasycricketupdates.
Figure1
Eachplayerplaysaroleofamanagerhere.Intheranklistthereisasymbolbesideseachmanger.
Therearethreekindsofsymbols.Theseareexplainedinthefollowingtable.
SymbolExplanationASCII
Representation
Therankoftheplayerhasupgradedafterlastmatch,i.e.U
ifthecurrentrankoftheplayerisK,therankofthe
playerbeforethelastmatchwasgreaterthanK.
TherankoftheplayerhasdowngradedafterthelastD
match,i.e.ifthecurrentrankoftheplayerisK,therank
oftheplayerbeforethelastmatchwaslessthanK.
TherankoftheplayerhasnotchangedafterthelastE
match,i.e.ifthecurrentrankoftheplayerisK,therank
oftheplayerbeforethelastmatchwasalsoK.
1|Page
Youwillbegivensuchascoreboardafteraparticularmatch.Canyoudetermineanypossiblevalid
orderingoftheplayeractlybeforethatround?Forthisproblemyouhavetoprintthenumberof
possibleorderingbeforethelastmatch.