Artifact Excavation
InterviewTime limit1sMemory limit1024 MB
Given the fragment coordinates of each artifact, find the artifact whose bounding rectangle has the largest area, breaking ties by smallest number.
- Level
Easy3 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
The Hongik University playground is a grid with rows and columns. Fragments of artifacts that could shake up the academic world have been found on this playground.
Only one artifact can be excavated at a time. So the artifact with the largest expected size is excavated first. If several artifacts share the largest expected size, the one with the smallest number is excavated first.
Each fragment is in size, and several fragments can be at the same position. The expected size of an artifact is the size of the smallest rectangle that encloses all of its fragments. All sides of the rectangle must be parallel to the sides of the playground.
Input
The first line contains two integers and , separated by a space.
The second line contains the number of fragments .
From the third line, the next lines each contain three integers , , and , separated by spaces. This means that a fragment of artifact is at row , column .
Output
Print the number of the artifact that is excavated first and its expected size, separated by a space.