Orecart Boba Hard
시간 제한1초메모리 제한2048 MB
두 사람이 각 정류장의 대기 시간을 지키며 오레카트와 동시에 도착할 수 있는 최소 이동 속도를 구한다.
문제
The only difference between this version and the easy version is that in this version, you must determine the minimum required speed yourself.
Eugin and Kelly are celebrating E-Days at the Colorado School of Mines by participating in the annual Orecart Pull. This is an event where everyone walks the Orecart down Colfax Avenue all the way to downtown Denver. Eugin and Kelly can go faster than the group, so they have decided to break off and grab boba from every stop along the route!
The walk is meters long, and the Orecart moves at a constant speed of meter per second. Eugin and Kelly can run at a speed of at most meters per second, but they are not allowed to move ahead of the Orecart at any time.
There are boba stops along the route, the -th of which is located at distance along the route. Additionally, at the -th boba stop, they must wait at least seconds to receive their boba before continuing.
Eugin and Kelly need to visit all boba stops while ensuring that they reach the end at exactly the same time as the Orecart. Determine the minimum required speed for them to accomplish this.
If it is impossible for any finite speed to allow them to reach the end on time, or if the required speed would need to exceed the speed of light ( meters per second), output IMPOSSIBLE. Otherwise, print the minimum required speed with a relative error of at most .
입력
The input consists of multiple lines:
- The first line contains two integers and ---the number of boba stops and the length of the route.
- The second line contains integers ---the distances at which each of the boba stops are located.
- The third line contains integers ---the waiting times at each boba stop.
출력
If it is impossible to reach the end on time no matter the speed, or if the required speed would need to exceed meters per second, print IMPOSSIBLE. Otherwise, print the minimum required speed such that the relative error does not exceed .