Editorial for LCC '24 Contest 2 S5 - Wheel of Fate


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: eogito

We use a dynamic programming with a bitmask to represent the states. Let dp[i] denote the maximum score achievable with sectors represented by the bitmask i. To calculate the maximum score, we iterate through all subsets of sectors using bitmasks from 0 to 2^{N-1}. For each subset i, we count how many sectors have been picked so far. For every unpicked sector j, we calculate the new score if that sector is added to the subset, considering the pie's value and the sector's multiplier, which depends on its adjusted position after the number of sectors picked rotations. We then update \(dp[i∣(1≪j)]\), the state where sector j is added, to the maximum of its current value and the new score.


Comments

There are no comments at the moment.