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(std::vector<std::vector<int> > a) {
int ans = 0 ;
int n = a.size() , m = a[0].size() ;
for(int i = 1 ; i < n - 1 ; i ++){
for(int j = 1 ; j < m - 1 ; j ++){
for(int i2 = i ; i2 < n - 1 ; i2 ++){
if(a[i][j] >= a[i - 1][j] || a[i][j] >= a[i][j - 1]){
break;
}int milhem = 0 ;
for (int j2 = j ; j2 < m - 1 && !milhem ; j2 ++){
int flag = 0 ;
for (int hi = i ; hi <= i2 && !flag; hi++){
for(int hj = j ; hj <= j2 && ! flag; hj++){
if(a[hi][hj] >= a[hi][j - 1] || a[hi][hj] >= a[hi][j2 + 1] || a[hi][hj] >= a[i - 1][hj] || a[hi][hj] >= a[i2 + 1][hj] )
flag++;
if(flag && (a[hi][hj] >= a[hi][j - 1] || a[hi][hj] >= a[i - 1][hj] || a[hi][hj] >= a[i2 + 1][hj]))
milhem++;
}
}
if(!flag)ans ++ ;
}
}
}
}
return ans;
}
# | 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... |