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;
long long count_rectangles(std::vector<std::vector<int> > a) {
int n = a.size(), m = a[0].size();
long long ans = 0;
for(int i1=1;i1<n-1;i1++)
{
for(int j1=1;j1<m-1;j1++)
{
for(int i2=i1;i2<n-1;i2++)
{
if(a[i2][j1] >= a[i2][j1 - 1] || a[i2][j1] >= a[i1 - 1][j1])
break;
for(int j2=j1;j1<m-1;j2++)
{
int can = 1;
for(int x=i1;x<=i2 && can;x++)
{
for(int y=j1;y<=j2 && can;y++)
{
if(a[x][y] >= a[i1 - 1][y] || a[x][y] >= a[i2 + 1][y] || a[x][y] >= a[x][j1 - 1] || a[x][y] >= a[x][j2 + 1])
{
can = 0;
break;
}
}
}
ans += can;
}
}
}
}
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... |