Company: Microsoft intern
Difficulty: medium
Car Assembly Lines In a car factory there are two assembly lines, called A and B. Each of them consists of N positions numbered from 0 to N-1. In each position, some component is installed into the car being assembled. The lines are symmetric; that is, the same component is installed into the car in the corresponding positions of A and B. In order to assemble a car, it needs to get through all of the positions on the assembly lines. It takes A[K] minutes to install the component in the K-th position on line A, and B[K] minutes to install it on line B. After installing a component in the K-th position, the car can either be: moved to the next position on the same line (which happens automatically and takes 0 minutes) moved to the other line. Switching from line A to line B takes X minutes, and switching from line B to line A takes Y minutes. The assembly process can be started in either line. Function Description int solution(int A[], int B[], int N, int X, int Y); Write a function that