Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please give a C++ code if possible. Language C++14 Autocomplete Ready 2. Saving humanity from Pandemic . 1> #include bits/stdc...) 9 10 . Complete the

image text in transcribedimage text in transcribed

Please give a C++ code if possible.

Language C++14 Autocomplete Ready 2. Saving humanity from Pandemic . 1> #include bits/stdc...) 9 10 . Complete the 'fetch_in_min_time' function below. 12 13 The function is expected to return an INTEGER. 14 The function accepts following parameters 15 * 1. INTEGER num_reg_cards 16 2. INTEGER exit position 17 3. INTEGER processing_trine 18 4. LONG_INTEGER_ARRAY factory_positions 19 */ 20 21 int fetch_in_min_time(int num_rec_cards, int exit_position, int processing, time, vector 22 23 } 24 25 > int main() As we all know that world is going through a pandemic and India has started production of PPE Kits and Ventilators promoting #Makeindia. Imagine a production strategy with multiple factories on a line. Initially, a DCGI Official is located at position with num_req_cards requirement cards in his possession, and the exit 15 at position exit_position. The Ith factory is located at factory_positions. The maximum moving speed of the Official is 1. When the Official gives a requirement card to a factory, it will provide the equipment after processing_time units of time. More specifically. If the ith factory is given a requirement card at timet, It will put the equipment at its position at time t-processing time The government of India needs your help to give requirement cards to all the factories, pick up all the equipment, and go to the edit Note that the Official can only give a requirement card to a factory if the Official is at the exact same position of the factory Also, each factory will only produce equipment once. If the Official visits the position of equipment after or at the exact same time that the equipment is put down, the player can pick up the equipment Equipment does not disappear until collected by the Official: You are given the configuration of the production environment. Please calculate the minimum time the official needs to collect all the equipment and go to the ext . I Function Description Complete the function fetch_In_mintime in the editor below. The function must return an integers that represent the minimum time to fetch all the equipments and exit at exit position fetch_in_min_time has the following parameters nur sea.card the number of requirement cards i postion the exposition progimo taken by each factory to produce Test Results Custom Input Input Format For Custom Testing Sample Case 0 Sample Input For Custom Testing 13 The function is expected to return an INTEGER. 14 The function accepts following parameters: 15 1. INTEGER num_req_cards 16 2. INTEGER exit_position 17 3. INTEGER processing time 18 4. LONG_INTEGER ARRAY factory_positions 19 20 21 int fetch_in_min_time(int num_req_cards, int exit_position, 22 23 } 24 25 > int main() - 3 9 1 3 1 3 8 Sample Output :::::::: 12 Explanation The optimal strategy is to wait for the equipment after providing each requirement card to each factory. The total time spent on waiting is 3 and moving is 9. So the answer is 3+9=12 Sample Case 1 Sample Input For Custom Testing 3 9 3 1 3 Sample Output Language C++14 Autocomplete Ready 2. Saving humanity from Pandemic . 1> #include bits/stdc...) 9 10 . Complete the 'fetch_in_min_time' function below. 12 13 The function is expected to return an INTEGER. 14 The function accepts following parameters 15 * 1. INTEGER num_reg_cards 16 2. INTEGER exit position 17 3. INTEGER processing_trine 18 4. LONG_INTEGER_ARRAY factory_positions 19 */ 20 21 int fetch_in_min_time(int num_rec_cards, int exit_position, int processing, time, vector 22 23 } 24 25 > int main() As we all know that world is going through a pandemic and India has started production of PPE Kits and Ventilators promoting #Makeindia. Imagine a production strategy with multiple factories on a line. Initially, a DCGI Official is located at position with num_req_cards requirement cards in his possession, and the exit 15 at position exit_position. The Ith factory is located at factory_positions. The maximum moving speed of the Official is 1. When the Official gives a requirement card to a factory, it will provide the equipment after processing_time units of time. More specifically. If the ith factory is given a requirement card at timet, It will put the equipment at its position at time t-processing time The government of India needs your help to give requirement cards to all the factories, pick up all the equipment, and go to the edit Note that the Official can only give a requirement card to a factory if the Official is at the exact same position of the factory Also, each factory will only produce equipment once. If the Official visits the position of equipment after or at the exact same time that the equipment is put down, the player can pick up the equipment Equipment does not disappear until collected by the Official: You are given the configuration of the production environment. Please calculate the minimum time the official needs to collect all the equipment and go to the ext . I Function Description Complete the function fetch_In_mintime in the editor below. The function must return an integers that represent the minimum time to fetch all the equipments and exit at exit position fetch_in_min_time has the following parameters nur sea.card the number of requirement cards i postion the exposition progimo taken by each factory to produce Test Results Custom Input Input Format For Custom Testing Sample Case 0 Sample Input For Custom Testing 13 The function is expected to return an INTEGER. 14 The function accepts following parameters: 15 1. INTEGER num_req_cards 16 2. INTEGER exit_position 17 3. INTEGER processing time 18 4. LONG_INTEGER ARRAY factory_positions 19 20 21 int fetch_in_min_time(int num_req_cards, int exit_position, 22 23 } 24 25 > int main() - 3 9 1 3 1 3 8 Sample Output :::::::: 12 Explanation The optimal strategy is to wait for the equipment after providing each requirement card to each factory. The total time spent on waiting is 3 and moving is 9. So the answer is 3+9=12 Sample Case 1 Sample Input For Custom Testing 3 9 3 1 3 Sample Output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions