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>
long long count_rectangles(std::vector<std::vector<int> > a) {
int n = a.size();
int m = a[0].size();
long long ans = 0;
for (int i = 1 ; i < n - 1 ; i++){
for (int j = 1 ; j < m - 1 ; j++){
int limitTol = n - 1;
int limitArad = m - 1;
for (int tol = 1 ; tol + i - 1 < limitTol ; tol++){
for (int arad = 1 ; arad + j - 1 < limitArad ; arad++){
int r1 = i, r2 = i + tol, c1 = j, c2 = j + arad;
bool ok = false;
for (int row = r1 ; row < r2 ; row++){
for (int cal = c1 ; cal < c2 ; cal++){
if (a[row][cal] < a[r1 - 1][cal] && a[row][cal] < a[row][c1 - 1] && a[row][cal] < a[r2][cal] && a[row][cal] < a[row][c2]){
continue;
}
else {
if (a[row][cal] >= a[r1 - 1][cal] || a[row][cal] >= a[row][c1 - 1])limitArad = cal;
ok = true;
break;
}
}
if (ok)break;
}
if (ok == false)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... |