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 <vector>
#include <iostream>
using namespace std;
long long count_rectangles(vector<vector<int>> a)
{
int n = a.size(), m = a[0].size();
int c = 0;
for(int i = 1; i<n-1; i++)
{
for(int j = 1; j<m-1; j++)
{
for(int h = i; h<n-1; h++)
{
//if(a[h+1][j]<=a[h][j])break;
for(int k = j; k<m-1; k++)
{
//if(a[h][k+1]<=a[h][k])break;
//if(k-j==h-i)break;
bool p = true;
for(int l = i; l<=h; l++)
{
if(!p)break;
for(int ll = j; ll<=k; ll++)
{
//cout<<a[l][ll]<<" ";
if(a[i-1][ll] <= a[l][ll] || a[h+1][ll]<= a[l][ll] || a[l][j-1] <= a[l][ll] || a[l][k+1]<=a[l][ll])p=false;
if(!p)break;
}
//cout<<endl;
}
//cout<<"---------"<<endl;
if(p)c++;
}
}
}
}
return c;
}
# | 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... |