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;
typedef long long ll;
const int maxn = 81;
int n, m;
int h[maxn][maxn];
long long count_rectangles(vector<vector<int> > a)
{
n = a.size();
m = a[0].size();
for (int i = 0; i < n; i ++)
for (int j = 0; j < m; j ++)
h[i][j] = a[i][j];
/**cout << "-----------" << endl;
for (int i = 0; i < n; i ++, cout << endl)
for (int j = 0; j < m; j ++)
cout << h[i][j] << " ";
cout << "-----------" << endl;*/
int ans = 0;
for (int i = 1; i < n - 1; i ++)
for (int j = 1; j < m - 1; j ++)
for (int x = i; x < n - 1; x ++)
for (int y = j; y < m - 1; y ++)
{
bool tf = true;
for (int dx = 0; dx <= x - i && tf; dx ++)
for (int dy = 0; dy <= y - j && tf; dy ++)
{
int cx = i + dx, cy = j + dy;
if (h[cx][cy] >= h[cx][j - 1] || h[cx][cy] >= h[cx][y + 1])
tf = false;
if (i == 1 && j == 1 && x == 2 && y == 1)
{
//cout << dx << " : " << dy << " : " << tf << endl;
///cout << h[cx][cy] << " -- " << h[cx][j - 1] << " -- " << h[cx][y + 1] << endl;
}
if (h[cx][cy] >= h[i - 1][cy] || h[cx][cy] >= h[x + 1][cy])
tf = false;
}
if (tf)
{
//cout << i << " " << j << " " << x << " " << y << endl;
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... |