K Devices
Practice
3.4 (46 votes)
Basic programming
Easy
Problem
92% Success 18718 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given the location of N devices on a coordinate plane and an integer K. Location of \(i^{th}\) device is donated by \((X_i, Y_i)\). A modem is located at \((0, 0)\). The range of modem is circular. All the devices within the range of the modem will connect to the modem. You have to find the minimum integral radius of the circular range of the modem such that at-least K devices will connect to the modem.

Input:
First line contains two integers, N \((1 \le N \le 10^5)\) and K \((1 \le K \le N)\). Second line contains N space separated integers denoting the array X \((-10^9 \le X_i \le 10^9)\). Third line contains N space separated integers denoting the array Y \((-10^9 \le Y_i \le 10^9)\).

Output:
Print one integer, denoting the minimum integral radius of the circular range of the modem such that at-least K devices will connect to the modem.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
38 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
2.War
Points:20
87 votes
Tags:
ApprovedBasic ProgrammingEasyOpen
Points:20
11 votes
Tags:
Easy