Repovive
  • Dashboard
  • Ranking
  • Submissions
  • Discussion
  1. Contests
  2. Standard Round 8
  3. 26A

My submissions

/
/
/
/

Announcements

My submissions

/
/
/
/

Announcements

Solve
Author

Separate the Equal Shares

From a bag containing aia_iai​ candies, Alice receives ⌊ai/2⌋\lfloor a_i/2\rfloor⌊ai​/2⌋ candies whether Alice or Bob opens it.

The only difference is the extra candy when aia_iai​ is odd. Alice receives that candy exactly when she opens the bag.

Therefore, her total is a fixed contribution B=∑i=1n⌊ai/2⌋B=\sum_{i=1}^{n}\lfloor a_i/2\rfloorB=∑i=1n​⌊ai​/2⌋, plus the number of odd-sized bags she opens.

This explains why choosing the largest bags is not the right goal: opening an even-sized bag gives Alice no advantage, while opening any odd-sized bag gives her exactly one extra candy.