bansals888's blog

By bansals888, history, 4 weeks ago, In English,

Hello Everyone!! I am having doubt about solving a problem. The problem goes like this.

Two players are alternating turns to eat a cookie. There are n cookies. Each cookie has two values ai and bi. (ai for first-person and bi for the second person). Now each player wants to maximize his own score. (Not the difference of the score). What will be the strategy?

Example :
n=3

(100,1) , (50,100), (1,2)

The first player will take cookie number 2 and cookie number 1. The second player will take cookie number 3. So the score of the first player is 50+100 and the score of the second player is 2.

It will be really helpful if someone can share his solution.

I don't have a link to the above problem but I got the idea of the problem when I was solving the below problem.

https://www.hackerearth.com/challenges/competitive/algorithms-india-hacks-2016/approximate/h-bear-and-cookies-2/description/

Thank You!!

 
 
 
 
  • Vote: I like it
  • +21
  • Vote: I do not like it