#include "rect.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long count_rectangles(vector<vector<int> > a) {
int height = a.size();
int width = a[0].size();
ll amount = 0;
for(int y = 1; y < height - 1; y++){
for(int x = 1; x < width - 1; x++){
for(int by = y; by < height - 1; by++)
{
for(int bx = x; bx < width - 1; bx++)
{
bool isPossible = true;
for(int i = y; i < by + 1; i++){
for(int j = x; j < bx + 1; j++){
int cell = a[i][j];
if(
cell >= a[i][x - 1] ||
cell >= a[i][bx + 1] ||
cell >= a[y - 1][j] ||
cell >= a[by + 1][j]
){
isPossible = false;
break;
}
}
if(!isPossible) break;
}
if(isPossible){
amount++;
}
}
}
}
}
return amount;
}
// #include "grader.cpp"
# | 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... |