This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "rect.h"
using namespace std;
long long count_rectangles(std::vector<std::vector<int> > grid) {
int n = grid.size();
int m = grid[0].size();
int cnt = 0;
for(int i = 1; i <= n - 2; i++){
for(int j = 1; j <= m - 2; j++){
for(int r = 1; r < n - 1; r++){
if(r + i - 1 >= n - 1)break;
for(int k = 1; k < m - 1; k++){
if(k + j - 1 >= m - 1)break;
bool ok = 1;
for(int a = r; a <= r + i - 1; a++){
if(!ok)break;
for(int b = k; b <= k + j - 1; b++){
if(grid[a][b] >= grid[r - 1][b] || grid[a][b] >= grid[r + i][b] || grid[a][b] >= grid[a][k - 1] || grid[a][b] >= grid[a][k + j]){
ok = 0;
break;
}
}
}
if(ok){
cnt++;
}
}
}
}
}
return cnt;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |