# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
207553 | 2020-03-08T03:05:47 Z | phamhoanghiep | Rectangles (IOI19_rect) | C++14 | 0 ms | 0 KB |
#include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; int a[n][m]; for(int i=0 ; i<n ; i++) { for(int j=0 ; j<m ; j++) { cin>>a[i][j]; } } int cnt=0; for(int r1=1 ; r1<n-1 ; r1++) { for(int r2=r1 ; r2<n-1 ; r2++) { for(int c1=1 ; c1<m-1 ; c1++) { for(int c2=c1 ; c2<n-1 ; c2++) { bool ok=true; for(int i=r1 ; i<=r2 ; i++) { for(int j=c1 ; j<=c2 ; j++) { if(a[i][j]>=a[i][c1-1]) ok=false; if(a[i][j]>=a[i][c2+1]) ok=false; if(a[i][j]>=a[r1-1][j]) ok=false; if(a[i][j]>=a[r2+1][j]) ok=false; } } if(ok==true) cnt++; } } } } cout<<cnt; }