eolymp
bolt
Try our new interface for solving problems
Məsələlər

Bad Signal

Bad Signal

There is an important UN meeting in town. Any self-respecting espionage agency will try to eavesdrop on the delegations to gain some advantage in the negotiations. They do this by planting hidden microphones in and around the meeting places. Those microphones continuously capture sound waves and transmit them via radio. In fact, fierce competition between espionage agencies has left the whole city scattered with hidden microphones, so much so that the radio waves interfere with each other and it is often not even possible to make out any signal in the mess of radio waves -- depending on your position and proximity to the different transmitters obviously. Specifically, it is possible to make out a signal \textbf{i} if and only if: \includegraphics{https://static.e-olymp.com/content/9d/9ded51d1a6ee4f1e78fd0f400c1504e17c88037e.jpg} Where \begin{itemize} \item \includegraphics{https://static.e-olymp.com/content/ba/ba788adc72406eda4ab89ac43488842a94b19d3c.jpg} is the strength of the received signal of microphone \textbf{i}, \item \textbf{s_i} is the strength of the signal sent from microphone \textbf{i}, \item \textbf{P_i} is the position of microphone \textbf{i}, \item \textbf{P}_listen is the position where you are listening to the signals, \item \textbf{|P_i-P_j|} is the Euclidean distance between points \textbf{P_i} and \textbf{P_j} and \item \textbf{B} is the level of background noise. \end{itemize} \InputFile On the first line one positive number: the number of test cases, at most \textbf{100}. After that per test case: \begin{itemize} \item one line with an integer \textbf{n }(\textbf{0 }≤ \textbf{n }≤ \textbf{100000}): the number of planted microphones. \item one line with the integer \textbf{B }(\textbf{0 }≤ \textbf{B }≤ \textbf{1000000}): the level of background noise. \item one line with two space-separated integers \textbf{x }and \textbf{y}: the \textbf{x }and \textbf{y }coordinates of the location Plisten where you receive the signals. \item \textbf{n} lines with three space-separated integers \textbf{x_i}, \textbf{y_i} and \textbf{s_i} (\textbf{0 }< \textbf{s_\{i \}}≤ \textbf{1000000}): the \textbf{x }and \textbf{y }coordinates of the location \textbf{P_i} of microphone \textbf{i} and its signal strength, respectively. \end{itemize} All coordinates are in the range \[\textbf{0}, \textbf{10000}\]. The locations \textbf{P_i} all differ from \textbf{P_listen}. The test data is constructed so that small floating point rounding errors will not influence the outcome of any solution. \OutputFile Per test case: \begin{itemize} \item one line with an integer: the (one-based) index of a microphone, the signal of which can be made out, or the string "\textbf{NOISE}" if there is no such microphone. \end{itemize}
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 122.17 MiB
Giriş verilənləri #1
3
4
10
100 100
90 90 20000
110 90 50
90 110 1000
110 110 50
4
100
100 100
90 90 20000
110 90 50
90 110 1000
110 110 50
2
0
0 10
0 0 1000
0 8 1
Çıxış verilənləri #1
1
NOISE
1
Mənbə 2013 Benelux Algorithm Programming Contest (BAPC), Preliminaries, September 28, Problem B