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>
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
/// #pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
using vi = vector<int>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
const int oo = 1000 * 1000 * 1000 + 7;
ll count_rectangles(vector<vector<int>> A) {
int N = A.size(), M = A[0].size();
ll res = 0;
if(N >= 3) {
for(int l = 1; l < N - 1; l++) {
for(int i = 1; i < M - 1; i++) {
for(int j = l; j < N - 1; j++) {
for(int k = i; k < M - 1; k++) {
bool ok = 1;
for(int x = l; x <= j && ok; x++) {
for(int y = i; y <= k && ok; y++) {
int U = min(A[l - 1][y], A[j + 1][y]);
int V = min(A[x][i - 1], A[x][k + 1]);
if(A[x][y] >= min(U, V))
ok = 0;
}
}
res += ok;
}
}
}
}
}
return res;
}
# | 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... |