Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int N = 1e3+5;
- int n, m, ans, l = 1e9, r = -1e9, u = 1e9, d = 1e9;
- bool M[N][N];
- int main(){
- ios_base::sync_with_stdio(0);
- cin.tie(0); cout.tie(0);
- cin >> n >> m;
- for(int i = 1; i <= n; ++i){
- for(int j = 1; j <= m; ++j){
- cin >> M[i][j];
- if(M[i][j]){
- l = min(j,l);
- r = max(j,r);
- u = min(i,u);
- d = max(i,u);
- }
- }
- }
- cout << u-2 << " " << l-2 << " " << d << " " << r;
- return 0;
- }
Add Comment
Please, Sign In to add comment