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
ll count_rectangles(vector<vector<int>> a){
int n = a.size(), m = a[0].size();
ll res = 0;
for (int k=1; k<m-1; k++){
for (int l=k; l<m-1; l++){
for (int i=1; i<n-1; i++){
bool stop = false;
for (int j=i; j<n-1; j++){
for (int y=k; y<=l; y++){
if (stop) break;
if (a[j][y] >= min(a[i-1][y], min(a[j][k-1], a[j][l+1]))) stop = true;
}
if (stop) break;
bool valid = true;
for (int x=i; x<=j; x++){
if (!valid) break;
for (int y=k; y<=l; y++){
if (!valid) break;
if (a[x][y] >= a[j+1][y]) valid = false;
}
}
if (valid) 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... |