Question
In a galaxy far, far away, the Empire has built n Death Satellites to attack n planets controlled by the rebels (each satellite will attack
In a galaxy far, far away, the Empire has built n Death Satellites to attack n planets controlled by the rebels (each satellite will attack exactly one planet). The Rebels have installed a defensive shield in each planet. The i-th satellite has power fi , while the shield on planet j can tolerate up to sj power. A successful attack on the i-th planet brings benefit bi to the Empire. That is, if planet i is attacked by the j-th satellite and fj > si , then the Empire will receive benefit bi ; otherwise, it will receive benefit 0. Match satellites to planets to maximize the Empires benefit in O(n log n) time, using a greedy algorithm.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started