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 "bits/stdc++.h"
#include "rect.h"
using namespace std;
int n, m;
long long count_rectangles(vector<vector<int>> a) {
int cnt = 0;
n = a.size();
m = a[0].size();
for (int t = 1; t < n-1; t++) {
for (int b = t; b < n-1; b++) {
for (int l = 1; l < m-1; l++) {
for (int r = l; r < m-1; r++) {
bool valid = true;
for (int i = t; i <= b; i++) {
for (int j = l; j <= r; j++) {
if (a[i][j] >= a[i][l-1]) valid = false;
if (a[i][j] >= a[i][r+1]) valid = false;
if (a[i][j] >= a[t-1][j]) valid = false;
if (a[i][j] >= a[b+1][j]) valid = false;
if (!valid) break;
}
if (!valid) break;
}
if (valid) 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... |