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;
typedef long long ll;
bool check(vector<vector<int> >& board,int a,int b,int c,int d)
{
//cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
for(int i=a;i<=b;i++){
for(int j=c;j<=d;j++){
//cout<<i<<" "<<j<<board[i][j]<<endl;
if(board[i][c-1]<=board[i][j])
return false;
if(board[i][d+1]<=board[i][j])
return false;
if(board[a-1][j]<=board[i][j])
return false;
if(board[b+1][j]<=board[i][j])
return false;
}
}
return true;
}
ll count_rectangles(vector<vector<int> > a) {
int n=a.size();
int m=a[0].size();
ll total=0;
for(int i=1;i<n-1;i++){
for(int j=1;j<m-1;j++){
for(int i2=i;i2<n-1;i2++){
for(int j2=j;j2<m-1;j2++){
if(check(a,i,i2,j,j2)) total++;//cout<<i<<" "<<i2<<" "<<j<<" "<<j2<<endl;
}
}
}
}
return total;
}
# | 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... |