Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int row, col;
- int main(){
- int x, ans;
- scanf("%d %d", &row, &col);
- vector<vector<int>> memo(row + 1, vector<int>(col + 1, 0));
- ans = 1;
- for(int i = 1; i <= row; ++i){
- for(int j = 1; j <= col; ++j){
- scanf("%d", &x);
- if(i == 1 || j == 1 || x == 0){
- continue;
- }
- memo[i][j] = 1 + min(min(memo[i - 1][j], memo[i][j - 1]), memo[i - 1][j - 1]);
- ans = max(ans, memo[i][j]);
- }
- }
- cout << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement