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;
long long count_rectangles(vector<vector<int>> a) {
// naive
int n = a.size(),m = a[0].size();
long long res = 0;
auto is_valid = [&](int x,int b,int c,int d){
for(int i=x;i<=c;i++){
for(int j=b;j<=d;j++){
if(a[i][j] >= min({a[x-1][j],a[c+1][j],a[i][b-1],a[i][d+1]}))return false;
}
}
return true;
};
for(int i=1;i+1<n;i++){
for(int j=1;j+1<m;j++){
for(int k=1;k<=i;k++){
for(int l=1;l<=j;l++){
if(is_valid(k,l,i,j)){
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... |