Quadrants and axes
Time limit1sMemory limit128 MB
Count how many of n points fall in each of the four quadrants and how many lie on an axis.
- Level
Easy1 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Problem
There are points on the two dimensional plane. Given the coordinates of each point, count how many points lie in each of the four quadrants and how many lie on an axis.
The quadrant of a point follows the signs of its two coordinates. and is the first quadrant, and is the second quadrant, and is the third quadrant, and and is the fourth quadrant.
A point whose or is belongs to no quadrant and counts as a point on an axis. The origin is a point on an axis as well.
Input
The first line contains the number of points . ()
Each of the next lines contains the coordinates and of one point, separated by a space. ()
The same coordinates may be given more than once, and every occurrence is counted separately.
Output
Print five lines in this format.
Q1: <number of points in the first quadrant>
Q2: <number of points in the second quadrant>
Q3: <number of points in the third quadrant>
Q4: <number of points in the fourth quadrant>
AXIS: <number of points on an axis>
Write the labels in upper case, and put one space after the colon before the count.