Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

COMM3 - Editorial

$
0
0

PROBLEM LINKS

Practice
Contest

DIFFICULTY

EASY

EXPLANATION

Try all 3 pairs of transceivers to see which ones can communicate directly. If at least 2 pairs can communicate directly then at least one transceiver can communicate directly with the other two so the answer is 'yes'. Otherwise, if at most 1 pair can communicate directly then the answer is 'no'. To determine if two transceivers located at (x1,y1) and (x2,y2) we simply check that (x1-x2) * (x1-x2) + (y1-y2) * (y1-y2) < = r * r. This is the same as checking that the distance between them is r, but we can avoid floating point computations this way. Note that the input numbers are small enough to ensure that the above expression only involves signed 32 bit integers.

SETTER'S SOLUTION

Can be found here.

TESTER'S SOLUTION

Can be found here.


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>