# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1186077 | HappyCapybara | Rectangles (IOI19_rect) | C++17 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
#include "rectangles.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 i=1; i<n-1; i++){
for (int j=1; j<m-1; j++){
for (int k=i; k<n-1; k++){
for (int l=j; l<m-1; l++){
res++;
for (int x=i; x<=k; x++){
bool stop = false;
for (int y=j; y<=l; y++){
if (min(min(a[x][j-1], a[x][l+1]), min(a[i-1][y], a[k+1][y])) <= a[x][y]){
res--;
stop = true;
break;
}
}
if (stop) break;
}
}
}
}
}
return res;
}