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;
#define ll long long
bool check(vector<vector<int>> &a, int xl, int xr, int yl, int yr) {
for (int i = xl; i <= xr; i++) {
for (int j = yl; j <= yr; j++) {
if (a[i][j] >= a[i][yl - 1] ||
a[i][j] >= a[i][yr + 1] ||
a[i][j] >= a[xl - 1][j] ||
a[i][j] >= a[xr + 1][j]) {
return false;
}
}
}
return true;
}
ll count_rectangles(vector<vector<int>> a) {
int n = a.size(),
m = a[0].size();
ll ans = 0;
for (int xl = 1; xl < n - 1; xl++) {
for (int yl = 1; yl < m - 1; yl++) {
for (int xr = xl; xr < n - 1; xr++) {
for (int yr = yl; yr < m - 1; yr++) {
if (check(a, xl, xr, yl, yr))
ans++;
}
}
}
}
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... |