All Tracks Problem

Two points and a circle
Tag(s):

Medium, 普通

Problem
Editorial
Analytics

There is a two-dimensional plane that contains multiple points at different locations. The coordinates of these points are provided in the Coordinates table.

There is also a circle of radius r and coordinates (x,y) of the center on the same plane. The specifications of the circle are provided in the Circle table.

Assuming that there is only one circle, write a query to return the points, which are either lying inside or outside the circle. The points must be in the order of the ID of each point.

Sample input

Table: Coordinates

Field Type
id Integer
x1 integer
y1 integer

Table: Circle

Field Type Remarks
r Integer radius of circle
x integer coordinate x is the center of the circle
y integer coordinate y is the center of the circle

Sample Coordinates table

ID x1 y1
1 10 20
2 20 10
3 5 10
4 10 5
5 30 5
6 5 30

Sample Circle table

r x y
5 10 10

Sample output

ID x1 y1
3 5 10
4 10 5
Time Limit: 5 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: MySQL, PostgreSQL, MSSQL, Oracle Database

CODE EDITOR

Initializing Code Editor...
Your Rating:
Notifications
View All Notifications