Advertisement
elephantsarecool

no2sol

Jan 18th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int a[1000][1000];
  4. int main()
  5. {
  6.     int maxx[1000],minn[1000];
  7.     int n,m;
  8.     cin>>n>>m;
  9.     for(int i=0;i<n;++i)
  10.         for(int j=0;j<m;++j)
  11.         {
  12.             cin>>a[i][j];
  13.             if(a[i][j]>maxx[i])maxx[i]=a[i][j];
  14.         }
  15.      for(int i=0;i<m;++i)
  16.         for(int j=0;j<n;++j)
  17.             if(a[j][i]<minn[i])minn[i]=a[j][i];
  18.       for(int i=0;i<n;++i)
  19.         for(int j=0;j<m;++j)
  20.             if(a[i][j]==minn[i] && a[i][j]==maxx[j]){cout<<a[i][j];return 0;}
  21.     cout<<"No solution";
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement