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;
/*bool f(int x,int xx,int y,int yy,vector<vector<int> >v){
for(int i=x;i<=xx;i++){
for(int l=y;l<=yy;l++){
if(v[i][l]>=v[x-1][l] or v[i][l]>=v[xx+1][l] or v[i][l]>=v[i][y-1] or v[i][l]>=v[i][yy+1]){
return false;
}
}
}
return true;
}*/
long long count_rectangles(vector<vector<int> > a) {
int n=a.size();
int m=a[0].size();
long long int res=0;
for(int i=1;i<n-1;i++){
for(int l=1;l<m-1;l++){
for(int ii=i;ii<n-1;ii++){
for(int ll=l;ll<m-1;ll++){
bool ok=true;
for(int j=i;j<=ii;j++){
for(int k=l;k<=ll;k++){
if(a[j][k]>=a[i-1][k] or a[j][k]>=a[ii+1][k] or a[j][k]>=a[j][l-1] or a[j][k]>=a[j][ll+1]){
ok=false;
}
if(ok==false){
break;
}
}
}
if(ok==true){
res++;
}
/*if(f(i,ii,l,ll,a)){
// cout<<i<<" "<<ii<<" "<<l<<" "<<ll<<endl;
res++;
}*/
}
}
}
}
return res;
}
# | 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... |