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 <stdio.h>
using namespace std;
int can1[205][205][205]={0};
int can2[205][205][205]={0};
long long count_rectangles(vector< vector<int> > all)
{
int N,M,i,j,k,l,m,n,big=0,ok;
long long ans=0;
N=all.size();
M=all[0].size();
for(i=0;i<N;i++)
{
for(j=1;j<M;j++)
{
big=0;
for(k=j;k<M-1;k++)
{
big=max(big,all[i][k]);
if(big<all[i][j-1]&&big<all[i][k+1]) can1[i][j][k]=1;
}
}
}
for(i=0;i<M;i++)
{
for(j=1;j<N;j++)
{
big=0;
for(k=j;k<N-1;k++)
{
big=max(big,all[k][i]);
if(big<all[j-1][i]&&big<all[k+1][i]) can2[i][j][k]=1;
}
}
}
for(i=1;i<N-1;i++)
{
for(j=i;j<N-1;j++)
{
for(k=1;k<M-1;k++)
{
for(l=k;l<M-1;l++)
{
ok=1;
for(m=i;m<=j;m++) for(n=k;n<=l;n++) ok=ok&&(all[m][n]<min(min(all[m][k-1],all[m][l+1]),min(all[i-1][n],all[j+1][n])));
//for(m=k;m<=l;m++) ok=ok&&can2[l][i][j];
if(ok) 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... |