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>
using namespace std;
long long count_rectangles(vector<vector<int>> a){
int n = a.size();
int m = a[0].size();
assert(n <= 30 && m <= 30);
int ans = 0;
for (int l = 1; l < m; l++){
for (int r = l + 1; r < m; r++){
for (int u = 1; u < n; u++){
for (int d = u + 1; d < n; d++){
bool ok = true;
for (int i = u; i < d; i++){
for (int j = l; j < r; j++){
if (a[i][j] >= a[u - 1][j]){
ok = false;
}
if (a[i][j] >= a[d][j]){
ok = false;
}
if (a[i][j] >= a[i][l - 1]){
ok = false;
}
if (a[i][j] >= a[i][r]){
ok = false;
}
}
}
if (ok){
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... |