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<iostream>
#include<vector>
using namespace std;
using ll = long long;
ll count_rectangles(vector<vector<int>>a) {
int n = a.size(), m = a[0].size();
ll ans = 0;
for (int r1 = 1 ; r1 < n - 1 ; ++ r1) {
for (int r2 = r1 ; r2 < n - 1 ; ++ r2) {
for (int c1 = 1 ; c1 < m - 1 ; ++ c1) {
for (int c2 = c1 ; c2 < m - 1 ; ++ c2) {
bool ok = true;
for (int i = r1 ; i <= r2 ; ++ i) {
for (int j = c1 ; j <= c2 ; ++ j) {
ok &= a[i][j] < a[i][c1 - 1] && a[i][j] < a[i][c2 + 1];
ok &= a[i][j] < a[r1 - 1][j] && a[i][j] < a[r2 + 1][j];
}
}
ans += ok;
}
}
}
}
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... |