제출 #618574

#제출 시각아이디문제언어결과실행 시간메모리
618574chirathnirodhaRectangles (IOI19_rect)C++17
0 / 100
441 ms1048576 KiB
#include "rect.h" #include<bits/stdc++.h> using namespace std; long long count_rectangles(vector<vector<int> > a) { int n=a.size(); int m=a[0].size(); int ans=0; int invalrow[n][m][m]; for(int i=0;i<m;i++)for(int j=0;j<m;j++)invalrow[0][i][j]=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<n;l++){ if(colvalid[l-1]==false)break; if(invalrow[j-2][k][l]-invalrow[i][k][l]>0)continue; 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;break;} } invalrow[j-1][k][l]=invalrow[j-2][k][l]; if(ok)ans++; else invalrow[j-1][k][l]++; } } } } 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...