Solve the following in C++ with the following function signature:

1. Laptop Assembly
In a factory, N workers are involved in a streamlined process of assembling M laptops in a conveyor belt system. The laptops have to be assembled in sequence from laptop 1 to laptop M. On each laptop, the workers have to do their job in sequence from worker 1 to worker N. Every laptop to be assembled has a factor of complexity, F. Each worker is responsible for a specific stage of the laptop assembly process, and the time taken (in minutes) by a worker to complete their part of the job on a laptop of complexity 1 is denoted by T. Therefore, the time needed for worker i to finish their part of the job on laptop / is computed as the product T,F). To avoid any dust pileup on open laptops, as soon as worker i completes their part, the laptop has to be immediately passed on to worker i+1 without any delay. Therefore, the starting time of assembling each laptop has to be managed such that all workers will be available when it is their turn to work on the laptop. Conf
m692
Your task is to write a program to determine the shortest possible time in which all laptops can be assembled, by determining the optimal assembly start time for each laptop, while following all the assembly line rules.
Read the input from STDIN and print the output to STDOUT. Do not print arbitrary strings anywhere in the program, as these contribute to the standard output and test cases will fail.
Constraints:
L. 1s MS 100000
ii. 1 s NS 100000
iii. 1 s T, s 10000
iv. 1 SF, s 10000
HackerRank Confidential
wasimakram69200
Input Format:
The first line of input contains two positive integers N and M, separated by a single whitespace. N denotes the number of workers and M denotes the number of laptops to be assembled.
The second line of input contains N integers, representing the time required by each of the N employees to complete their work on a laptop of complexity 1.
The third line of input contains M integers, representing the factor of complexity for each of the M laptops.
Output Format:
Single line of output should contain the minimum total time required to assemble all the laptops in the prescribed order.


Input Format:
The first line of input contains two positive integers N and M, separated by a single
whitespace. N denotes the number of workers and M denotes the number of laptops to be assembled.
The second line of input contains N integers, representing the time required by each of
the N employees to complete their work on a laptop of complexity 1.
The third line of input contains M integers, representing the factor of complexity for each of
the M laptops.
Output Format:
Single line of output should contain the minimum total time required to assemble all the laptops in the prescribed order. Confiden
Sample Input1:
69200
23
58
416
.com
Sample Output1:
130
Explanation1:
HackerRank Confidential
Here, the number of workers is 2, and the number of laptops is 3.
was
The time needed by the workers for a laptop of complexity 1 is 5, 8 minutes respectively. The assembly complexity of the laptops is 4, 1, 6 respectively.
Hence, for the first laptop (complexity = 4), the first worker needs 5x4-20 min and the second worker needs 8x4=32 min.
For the second laptop (complexity = 1), the first worker needs 5x1-5 min and the second worker needs 8x1-8 min.
For the third laptop (complexity = 6), the first worker needs 5x6-30 min and the second worker needs 8x6-48 min.
Hacke
The first worker beings the first laptop assembly and finishes it after 20 min.
The second worker then begins his part at minute 21 and finishes the first laptop assembly at minute 52.
Now let's say the first worker begins the second laptop assembly as soon as he is free. So he 01st minute and finishes the assembly at 25th minute However the second worker is


Sample Output1: 130
Explanation1:
Here, the number of workers is 2, and the number of laptops is 3.
The time needed by the workers for a laptop of complexity 1 is 5, 8 minutes respectively. The assembly complexity of the laptops is 4, 1, 6 respectively.
Hence, for the first laptop (complexity = 4), the first worker needs 5x4-20 min and the second worker needs 8x4=32 min.
For the second laptop (complexity = 1), the first worker needs 5x1-5 min and the second worker needs 8x1=8 min.
For the third laptop (complexity = 6), the first worker needs 5x6=-30 min and the second worker needs 8x6-48 min.
4
The first worker beings the first laptop assembly and finishes it after 20 min. The second worker then begins his part at minute 21 and finishes the first laptop assembly at minute 52.
ank Co
akram
Now let's say the first worker begins the second laptop assembly as soon as he is free. So he starts at 21st minute and finishes the assembly at 25th minute. However the second worker is still working on the first laptop and will be available only at 53rd minute. Therefore the laptop cannot be handed over immediately.
Hence the first worker should wait and start assembly of second laptop only at minute 48, and finish at minute 52. At 53rd minute the second worker (who is now available) starts assembly and finishes it in 8 minutes (by minute 60), becoming available at minute 61.
Worker one can start assembly of the third laptop as soon as he is free, from minute 53 onwards, completing the job in 30 minutes, at minute 82. At 83rd minute the second worker can start his part (as he is available from minute 61) and finish the job in 48 minutes at minute 130. Hence in 130 minutes all the three laptops are assembled.
Sample Input2:
45
4222 31112

Sample Output2:
54
Explanation2:

The total time required to assemble all the laptops in the prescribed order is 54 minutes.



#include <iostream> #include <vector>
using namespace std;
int timeRequired(int N, int M, vector<int> T, vector<int> F) { // N is the number of employees and M is the number of Laptops, T is an array that holds N workers time, and F is an array that holds factor of complexity for the M Laptops..
int res = 0;
// WRITE YOUR CODE HERE.
return res;
}
int main() {
int M, N;
cin >> N >> M;
vector<int> workerTimes (N); vector<int> laptopComplexities (M);
for (int i
}
=
0; i < N; ++i) {
cin >> workerTimes[i];
for (int j = 0; j < M; ++j) {
cin >> laptopComplexities[j];
}
int res = timeRequired (N, M, workerTimes, laptopComplexities);
cout<<res;
return 0;