# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1031035 | 2024-07-22T13:45:06 Z | Marco_Escandon | Rectangles (IOI19_rect) | C++17 | 0 ms | 0 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; long long count_rectangles(std::vector<std::vector<int> > a) { ll cont=0; ll n=a.size();ll m=a[0].size(); for(int i=0; i<n-1; i++) { for(int j=0; j<m-1; j++) { ll c1=cont; for(int k=i+2; k<n; k++) { for(int l=j+2; l<m; l++) { ll pl=1; for(int o=i+1; o<k; o++) { for(int p=j+1; p<l; p++) { if(a[o][p]>=min(min(a[i][p],a[k][p]),min(a[o][j],a[o][l]))) { pl=0; goto fin1; } } } fin1:; cont+=pl; } } } } return cont; } int main() { int n, m; cin>>n; cin>>m; vector<vector<int>> a(n, vector<int>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin>>a[i][j]; } } long long result = count_rectangles(a); cout<<result; return 0; }