제출 #428569

#제출 시각아이디문제언어결과실행 시간메모리
428569HazemRectangles (IOI19_rect)C++14
0 / 100
14 ms6604 KiB
#include "rect.h" #include <bits/stdc++.h> #define LL long long using namespace std; const int N = 751; int n,m; int col[5][5][N],row[N][N][5]; long long count_rectangles(std::vector<std::vector<int> > a) { n = a.size(); m = a[0].size(); for(int i=0;i<n;i++) for(int j=0;j<m;j++){ int mx = 0; for(int k=j+1;k<m;k++){ if(k-j>1&&mx<a[i][j]&&mx<a[i][k]) row[j][k][i]++; mx = max(mx,a[i][k]); } } for(int i=0;i<m;i++) for(int j=0;j<n;j++){ int mx = 0; for(int k=j+1;k<n;k++){ if(k-j>1&&mx<a[j][i]&&mx<a[k][i]) col[j][k][i]++; if(i) col[j][k][i] += col[j][k][i-1]; mx = max(mx,a[k][i]); } } LL ans = 0; for(int i=0;i<n;i++) for(int j=0;j<m;j++) for(int k=j+1;k<m;k++){ int q = 1; for(int k1 = i+1;k1<n;k1++){ if(k1-i>1&&k-j>1) ans += q&(col[i][k1][k-1]-col[i][k1][j]==(k-j-1)); q &= row[j][k][k1]; } } 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...