Saddle points
Very easy
Execution time limit is 2 seconds
Runtime memory usage limit is 128 megabytes
The matrix is given. It contains rows and columns. The saddle point of the matrix is an element that is minimum in its row and maximum in its column.
Find the number of saddle points in a given matrix.
Input
The first line contains two integers and . Then given rows with numbers in each. The -th number of the -th line equals . All do not exceed by absolute value.
Output
Print the number of saddle points.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 5K
Acceptance rate 39%