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"
#include <bits/stdc++.h>
using namespace std;
long long count_rectangles(vector<vector<int>> a) {
int n = a.size(), m = a[0].size();
long long ans = 0;
for (int x = 1; x < n - 1; ++x) {
for (int y = 1; y < m - 1; ++y) {
bool bad = 0;
for (int i = x; i < n - 1 && !bad; ++i) {
for (int j = y; j < m - 1; ++j) {
if (a[i][y] >= a[i][y - 1]) {
bad = 1;
break;
}
if (a[i][j] >= a[x - 1][j] || a[i][j] >= a[i + 1][j]) {
break;
}
bool good = 1;
for (int l = x; l <= i; ++l) {
for (int r = y; r <= j; ++r) {
good &= a[l][r] < a[l][j + 1];
}
}
ans += good;
}
}
}
}
return ans;
}
# | 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... |