Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,m;
- cin>>n>>m;
- int a[n+1][m+1];
- bool ok=false;
- for(int i=1;i<=n;++i)
- for(int j=1;j<=m;++j)
- cin>>a[i][j];
- int x;
- cin>>x;
- for(int i=1;i<=n&&!ok;++i)
- if(a[i][1]==x||a[i][m]==x)
- ok=true;
- for(int j=1;j<=m&&!ok;++j)
- if(a[1][j]==x||a[n][j]==x)
- ok=true;
- if(ok)
- cout<<"DA";
- else
- cout<<"NU";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement