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 endl "\n"
// #define int long long
typedef long long ll ;
const ll ooo = 1e14 ;
const ll oo = 2e9 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7 ;
const int N = 10000010 ;
bool val[2510][2510] , sum[2510][2510];
int r[4] = {1 , -1 , 0 , 0} ,
c[4] = {0 , 0 , 1 , -1} ;
ll count_rectangles(vector<vector<int> > a) {
int n = a.size() , m = a[0].size();
ll ans = 0;
for(int i = 1 ; i < n - 1 ; ++i){
for(int j = 1 ; j < m - 1 ; ++j){
for(int i1 = i ; i1 < n - 1 ; ++i1){
for(int j1 = j ; j1 < m - 1 ; ++j1){
bool flag = 1 ;
for(int x = i ; x <= i1 && flag ; ++x)
for(int y = j ; y <= j1 ; ++y){
if(a[x][y] >= min(min(a[i - 1][y] , a[i1 + 1][y])
, min(a[x][j - 1] , a[x][j1 + 1]))){
flag = 0;
break;
}
}
// if(flag) cout << i << ' ' << j << " " << i1 << ' ' << j1 << endl;
ans += flag;
}
}
}
}
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... |