Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help to implement a complete python code that solves this problem with the given limitations . the previous solution for this problem using another
Need help to implement a complete python code that solves this problem with the given limitations.
the previous solution for this problem using another programming language or wrong approach with wrong answers!
the problem:
D. Missile Interception time limit per test 1 second0 memory limit per test: 256 megabytes input: standard input output: standard output Yihan recently designed a missile interception system for the Ministry of Defense. Once the system is deployed, it can intercept and destroy all missiles within a given radius. The radius can be 0 , in which case it protects the certain point that the system is placed. For the testing purpose, two of such systems are deployed, and N missiles are launched. Of course, all missiles will surely be intercepted at the radi are set to be infinitely large. However, setting a large radius is costly. The cost is proportional to the square of the radius (L.e., the protected area), so Yihan wants to compute the smallest sum of the squared radii, which is sutficient to intercept all missiles and finish the testing. Input The first line contains four integers x1,y1,x2, and y2, indicating that the two systems are deployed at (x1,y1) and (x2,y2). The second line contains an integer N, indicating the number of testing missiles. Then for the next N lines, each line contains two integers x and y, indicating that each missile is sent to the coordinates (x,y). Output One integer; r12+r22, where r1 is the protecting radius for system 1,andr2 is for system 2. Note N105, All absolute values for the coordinates are no more than 1000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started