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"
long long count_rectangles(std::vector<std::vector<int> > a) {
int n=a.size();
if(n<3)
{
return 0;
}
int m=a[0].size();
int ans=0;
for(int i=1;i<m-1;i++)
{
int frontbound=a[1][i-1];
int max=0;
int j=i;
{
while(j<m-1)
{
if(max<a[1][j])
{
max=a[1][j];
}
if(a[1][j]>=a[0][j] || a[1][j]>=a[2][j])
{
break;
}
else if(max>=frontbound || max>=a[1][j+1])
{
j++;
}
else
{
//cout<<i<<" "<<j<<endl;
ans++;
j++;
}
}
}
}
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... |