K Devices
Tag(s):

## Basic Programming, Easy

Problem
Editorial
Analytics

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.

SAMPLE INPUT
3 3
1 -1 1
1 -1 -1

SAMPLE OUTPUT
2

Explanation

All the devices are at distance $\sqrt 2$ from the modem. So, the minimum integral radius of the circular range of the modem such that at-least 3 devices will connect to the modem will be 2.

Time Limit: 1,0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in

Challenge Name

August Circuits '17

OTHER PROBLEMS OF THIS CHALLENGE
• Algorithms > Graphs
• Algorithms > Dynamic Programming
• Math > Combinatorics