Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <string>
- #include <algorithm>
- #include <cmath>
- #include <iomanip>
- #include <fstream>
- #include <deque>
- #include <vector>
- #include <stack>
- using namespace std;
- int main() {
- ifstream in("input.txt");
- ofstream out("output.txt");
- long long n, m;
- in >> n >> m;
- long long t[399][399];
- long long x[399] = {0};
- long long y[399] = {1000};
- long long x1[399];
- long long y1[399];
- long long mxX = 0, mnY = 1000, c = 0;
- for (long long i = 0; i < n; i++) {
- for (long long j = 0; j < m; j++) {
- in >> t[i][j];
- long long h = t[i][j];
- if (h > x[i]) {
- x1[i] = max (h,x[i]);
- }
- if (h < y[i]) {
- y1[i] = min (h, y[i]);
- }
- }
- }
- for (long long i = 0; i < n; i++) {
- for (long long j = 0; j < m; j++) {
- if (t[i][j] == x1[i] && t[i][j] == y1[i]) {
- c++;
- }
- }
- }
- out << c;
- out.close();
- in.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement