Question: Give an efficient algorithm that takes the data on robot arrivals x1, x2, ... ,xn, and the recharging function f(i) and returns the maximum number

 Give an efficient algorithm that takes the data on robot arrivals

Give an efficient algorithm that takes the data on robot arrivals x1, x2, ... ,xn, and the recharging function f(i) and returns the maximum number of robots that can be destroyed by a sequence of EMP activations.

The residents of the underground city of Zion defend themselves through a combination of kung fu, heavy artillery, and efficient algorithms. Recently they have become interested in automated methods that can help fend off attacks by swarms of robots. Here's what one of these robot attacks looks like . A swarm of robots arrives over the course of n seconds, in the ith second, xi robots arrive. Based on remote sensing data, you know this sequence x1 . You have at your disposal an electromagnetic pulse (EMP), which can destroy some of the robots as they arrive, the EMP's power depends on how long it's been allowed to charge u make this precise, there is a function f (-) so that if j seconds have passed since the EMP was last used, then it is capable of destroying up to fO) robots . So specifically, if it is used in the kth second, and it has been j seconds since it was previously used, then it will destroy min(xk, f G) robots. (After this use, it will be completely drained.) .We will also assume that the EMP starts off completely drained, so if it is used for the first time in the jth second, then it is capable of destroying up to f0) robots The problem. Given the data on robot arrivals x1, x2, xn, and given the recharging function f (-), choose the points in time at which you're going to activate the EMP so as to destroy as many robots as possible. Example. Suppose n 4, and the values of xt and f () are given by the following table. x2?xn in advance 1 2 34 xi 1 10 10 1 f () 1 2 4 8 The best solution would be to activate the EMP in the 3rd and the 4th seconds. In the 3rd second, the EMP has gotten to charge for 3 seconds, and so it destroys min(10,4) 4 robots; In th second, the EMP has only gotten to charge for 1 second since min(1,1)- 1 robot. This is a total of 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!