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 m_p make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
const int N = 2505;
int n, m;
int a[N][N];
long long count_rectangles(std::vector<std::vector<int> > A)
{
n = sz(A);
m = sz(A[0]);
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= m; ++j)
{
a[i][j] = A[i - 1][j - 1];
}
}
ll ans = 0;
for (int x1 = 2; x1 < n; ++x1)
{
for (int x2 = x1; x2 < n; ++x2)
{
for (int y1_ = 2; y1_ < m; ++y1_)
{
for (int y2 = y1_; y2 < m; ++y2)
{
bool z = true;
for (int i = x1; i <= x2; ++i)
{
for (int j = y1_; j <= y2; ++j)
{
if (a[i][j] >= a[x1 - 1][j])
{
z = false;
break;
}
if (a[i][j] >= a[x2 + 1][j])
{
z = false;
break;
}
if (a[i][j] >= a[i][y1_ - 1])
{
z = false;
break;
}
if (a[i][j] >= a[i][y2 + 1])
{
z = false;
break;
}
}
if (!z)
break;
}
if (z)
++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... |