By broadway, history, 6 weeks ago,

You are playing the game "Blasting The Sheep". The goal of the game is to blast off all sheep in the current level. The level in the game is described by a string of length n, consisting of the characters '.' (empty space) and '*' (sheep).

In one move, you can perform one of the following actions:
- Move any sheep one square to the left or one square to the right, if the corresponding square exists and is empty. This will take A units of time.
- Use the Blasters over a continuous substring consisting only those cells that currently harbor a sheep. This will take B units of time.

The game ends as soon as there no sheep on the level.
For example, if n=6 and the level is described by the string "**.*..", then the following game scenario is possible:

- The sheep at position 4 moves to the right, the state of the level: "**..*."
- The sheep at position 2 moves to the right, the state of the level: "*.*.*."
- The sheep at position 1 moves to the right, the state of the level: ".**.*."
- Use Blasters over the substring s[2:3], the state of the level: "....*."
- Use Blasters over the substring s[5:5], the state of the level: "......"
- the sheep are blasted away into oblivion and the game ends.

For a given level, determine the minimum time in which you can complete the level.

• -13

 » 6 weeks ago, # |   +1 What do you want to know?
•  » » 6 weeks ago, # ^ |   +1 For a given level, determine the minimum time in which you can complete the level. You don't like to read?
 » 6 weeks ago, # |   -22 tera naam broadway nhi badwe rakhna chaiye tha
•  » » 6 weeks ago, # ^ |   0 Why are you making derogatory comments about an absolute stranger on codeforces? I expected better from a person with your rating and dedication towards CP. And a sincere token of gratitude for the rest of the CF community for upvoting such a nonsense comment.
•  » » » 6 weeks ago, # ^ |   +5 that was a good joke though...
•  » » » 6 weeks ago, # ^ | ← Rev. 2 →   0 what are you really asking ? you just posted a problem from recent contest with no context. if you don't know how to solve it you can find the solution in tutorial post, https://codeforces.com/blog/entry/90342. if you want to discuss the solution you can do so by commenting to that tutorial post nobody will downvote you there.
•  » » » » 6 weeks ago, # ^ |   +8 But it's not the same problem. Read carefully.
•  » » » » » 6 weeks ago, # ^ |   +12 sorry my bad
•  » » 6 weeks ago, # ^ |   +6 People like you give the Internet a bad reputation. I hope you feel good about yourself after making worthless comments.
•  » » 6 weeks ago, # ^ |   +1 Toh uss hisab se toh tera naam, ChamanC*****a :) He asked solution/help for a problem. At-least read once, before saying anything in a community. People like you are responsible for the bad reputation of our country, to be honest. If you want to help, help him, else just leave, no need for derogatory comments.
 » 6 weeks ago, # |   +1 I dont understand why people are so ignorant,He has asked different problem but still downvotes!!!