# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
667308 | coding_snorlax | Rectangles (IOI19_rect) | C++14 | 0 ms | 0 KiB |
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<bits/stdc++.h>
#include "rectangles.h"
using namespace std;
int n,m;
long long int count_rectangles(vector<vector<int>> a){
int n=a.size();
int m=a[0].size();
long long int answer=0;
for(int i=1;i<n-1;i++){
for(int j=1;j<m-1;j++){
for(int k=1;k<=i;k++){
for(int l=1;l<=j;l++){
//rectangle (k,i) , (l,j)
int flag=1;
for(int p=k;p<=i;p++){
for(int q=l;q<=j;q++){
if(a[p][q]>=min(min(a[p][j+1],a[p][l-1]),min(a[k-1][q],a[i+1][q]))){
//cout<<i<<" "<<j<<" "<<k<<" "<<l<<" "<<p<<" "<<q<<endl;
flag=0;
}
}
}
answer+=flag;
}
}
}
}
return answer;
}