Canadian Computing Competition: 2020 Stage 1, Junior #3
Mahima has been experimenting with a new style of art. She stands in front of a canvas and, using her brush, flicks drops of paint onto the canvas. When she thinks she has created a masterpiece, she uses her 3D printer to print a frame to surround the canvas.
Your job is to help Mahima by determining the coordinates of the smallest possible rectangular frame such that each drop of paint lies inside the frame. Points on the frame are not considered inside the frame.
The first line of input contains the number of drops of paint, , where and is an integer. Each of the next lines contain exactly two positive integers and separated by one comma (no spaces). Each of these pairs of integers represent the coordinates of a drop of paint on the canvas. Assume that and , and that there will be at least two distinct points. The coordinates represent the bottom-left corner of the canvas.
For of the available marks, and will both be two-digit integers.
Output two lines. Each line must contain exactly two non-negative integers separated by a single comma (no spaces). The first line represents the coordinates of the bottom-left corner of the rectangular frame. The second line represents the coordinates of the top-right corner of the rectangular frame.
Output for Sample Input
Explanation of Output for Sample Input
The bottom-left corner of the frame is . Notice that if the bottom-left corner is moved up, the paint drop at will not be inside the frame. (See the diagram.) If the corner is moved right, the paint drop at will not be inside the frame. If the corner is moved down or left, then the frame will be larger and no longer the smallest rectangle containing all the drops of paint. A similar argument can be made regarding the top-right corner of the frame.