SHARE
TWEET

Untitled

a guest Jun 20th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int c , r , sedl , ksedl;
  8.     cin >> r >> c;
  9.     int a[r][c];
  10.     ksedl = 0;
  11.     int m = 0;
  12.     int g = 100000;
  13.     int minstr[r];
  14.     int maxcol[c];
  15.     for (int i = 0; i < r;i++){
  16.         for (int j = 0; j < c ;j++){
  17.             cin >> a[i][j];
  18.         }
  19.     }
  20.     for (int i = 0; i < r;i++){
  21.         for (int j = 0; j < c ;j++){
  22.             if (a[i][j] <= g){
  23.                 g = a[i][j];
  24.             }
  25.         }
  26.         minstr[i] = g;
  27.         g = 100000;
  28.     }
  29.     int g2 = -10000;
  30.  
  31.         for (int j = 0; j < r ;j++){
  32.             for (int i = 0; i < c;i++){
  33.                  if (a[i][j] >= g2){
  34.                  g2 = a[i][j];
  35.             }
  36.         }
  37.         maxcol[j] = g2;
  38.         g2 = -10000;
  39.     }
  40.     for (int i = 0; i < r ;i++){
  41.         for (int j = 0;j < c; j ++){
  42.             if (a[i][j] == minstr[i] && a[i][j] == maxcol[j]){
  43.                 m++;
  44.             }
  45.         }
  46.     }
  47.     cout << m;
  48.     return 0;
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top