You give your start position and the gun's start angle and turn rate, then compute the fastest run speed at which the rotating gun still catches you.
Hard9Game theoryGeometryMathNo attempts yetTime limit2sMemory limit256 MBYou are running from an enemy. The enemy is a sniper with a laser gun, and a single hit ends the chase, so you want to know how fast you have to run to stay alive.
You and the sniper are on the xy-plane, with the x-axis pointing right and the y-axis pointing up. The plane is infinite, and nothing blocks the laser or your movement.
The sniper and the gun are at (0,0) and never move. The gun turns continuously at a rate of at most ω degrees per unit time, clockwise or counterclockwise, and the sniper may reverse the turn at any moment. At time 0 the gun points θ degrees counterclockwise from the positive direction of the x-axis.
You start at (x,y) and may move in any direction at a speed of at most v. You choose the value of v yourself. You are shot exactly when the gun points at your position, so the time the laser needs to reach you is ignored. You are a point, and the laser is a half-line whose endpoint is (0,0).
Both you and the sniper act optimally. Find the largest speed v for which the sniper still shoots you in finite time.
One line holds four integers x, y, θ, ω separated by spaces.
At time 0 the gun does not point at your position.
Print the largest speed v on one line, rounded to exactly 8 digits after the decimal point, in the format printf("%.8f") produces. No test is close enough to a rounding boundary for a correct double-precision computation to change the last digit.