Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a[1000][1000];
- int main()
- {
- int maxx[1000],minn[1000];
- int n,m;
- cin>>n>>m;
- for(int i=0;i<n;++i)
- for(int j=0;j<m;++j)
- {
- cin>>a[i][j];
- if(a[i][j]>maxx[i])maxx[i]=a[i][j];
- }
- for(int i=0;i<m;++i)
- for(int j=0;j<n;++j)
- if(a[j][i]<minn[i])minn[i]=a[j][i];
- for(int i=0;i<n;++i)
- for(int j=0;j<m;++j)
- if(a[i][j]==minn[i] && a[i][j]==maxx[j]){cout<<a[i][j];return 0;}
- cout<<"No solution";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement