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(std::vector<std::vector<int>> g){
int n = g.size(), m = g[0].size();
if (n <= 2 || m <= 2) return 0;
int ans = 0;
for (int l = 1; l < n - 1; l++){
for (int r = l; r < n - 1; r++){
for (int i = 1; i < m - 1; i++){
vector<int> maxn(r - l + 1);
for (int j = i; j < m - 1; j++){
bool flag = 0;
for (int ii = l; ii <= r; ii++){
if (min(g[l - 1][j], g[r + 1][j]) <= g[ii][j])
flag = 1;
maxn[ii - l] = max(maxn[ii - l], g[ii][j]);
}
if (flag) break;
for (int ii = l; ii <= r; ii++){
if (min(g[ii][i - 1], g[ii][j + 1]) <= maxn[ii - l])
flag = 1;
}
ans += !flag;
}
}
}
}
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... |