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 sz(v) int(v.size())
#define ar array
typedef long long ll;
const int N = 2.5e3+10, MOD = 1e9+7;
long long count_rectangles(vector<vector<int>> a) {
int n = sz(a), m = sz(a[0]);
ll ans = 0;
for (int l1 = 1; l1 < n-1; l1++) {
for (int r1 = l1; r1 < n-1; r1++) {
for (int l2 = 1; l2 < m-1; l2++) {
for (int r2 = l2; r2 < m-1; r2++) {
bool bad = 0;
for (int i = l1; i <= r1 && !bad; i++) {
for (int j = l2; j <= r2 && !bad; j++) {
if (a[i][j] >= a[l1-1][j]) bad = 1;
if (a[i][j] >= a[i][l2-1]) bad = 1;
if (a[i][j] >= a[r1+1][j]) bad = 1;
if (a[i][j] >= a[i][r2+1]) bad = 1;
}
}
ans += !bad;
}
}
}
}
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... |