Submission #618698

#TimeUsernameProblemLanguageResultExecution timeMemory
618698chirathnirodhaRectangles (IOI19_rect)C++17
37 / 100
5056 ms22732 KiB
#include "rect.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; long long count_rectangles(vector<vector<int> > a) { int n=a.size(); int m=a[0].size(); ll ans=0; for(int i=0;i<n;i++){ int colmax[m];memset(colmax,-1,sizeof(colmax)); bool colvalid[m];memset(colvalid,false,sizeof(colvalid)); for(int j=i+2;j<n;j++){ for(int k=0;k<m;k++){ colmax[k]=max(colmax[k],a[j-1][k]); if(colmax[k]>=a[i][k] || colmax[k]>=a[j][k])colvalid[k]=false; else colvalid[k]=true; } for(int k=0;k<m;k++){ int rowmax[n];memset(rowmax,-1,sizeof(rowmax)); for(int l=k+2;l<m;l++){ if(colvalid[l-1]==false)break; bool ok=true; for(int p=i+1;p<=j-1;p++){ rowmax[p]=max(rowmax[p],a[p][l-1]); if(rowmax[p]>=a[p][k] || rowmax[p]>=a[p][l])ok=false; } if(ok)ans++; } } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...