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;
#define ll long long
#define pb push_back
typedef pair<ll,ll> pii;
const ll MAXN = 2e5+5;
const ll INF = 1e9+7;
long long count_rectangles(std::vector<std::vector<int> > a) {
ll n=a.size(),m=a[0].size(),i,j,ii,jj,A,B,ans=0;
int maxi;
bool ok;
for(i=1;i<n-1;i++){
for(j=1;j<m-1;j++){
for(ii=i;ii<n-1;ii++){
for(jj=j;jj<m-1;jj++){
ok=true;
for(A=i;A<=ii;A++){//verificar esta
maxi=-1;
for(B=j;B<=jj;B++)maxi=max(maxi,a[A][B]);
if(maxi>=min(a[A][j-1],a[A][jj+1])){
ok=false;
break;
}
}
if(!ok)continue;
for(B=j;B<=jj;B++){//verificar esta
maxi=-1;
for(A=i;A<=ii;A++)maxi=max(maxi,a[A][B]);
if(maxi>=min(a[i-1][B],a[ii+1][B])){
ok=false;
break;
}
}
if(ok)ans++;
}
}
}
}
/*
6 5
4 8 7 5 6
7 4 10 3 5
9 7 20 14 2
9 14 7 3 6
5 7 5 2 7
4 5 13 5 6
*/
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... |