Submission #772944

#TimeUsernameProblemLanguageResultExecution timeMemory
772944Abrar_Al_SamitRectangles (IOI19_rect)C++17
37 / 100
5044 ms34056 KiB
#include "rect.h" #include <bits/stdc++.h> using namespace std; long long count_rectangles(vector<vector<int> > b) { int n = b.size(), m = b[0].size(); vector<vector<int>>a(m); for(int i=0; i<m; ++i) { a[i].resize(n); } for(int i=0; i<n; ++i) { for(int j=0; j<m; ++j) { a[j][i] = b[i][j]; } } swap(n, m); int ans = 0; for(int r1=1; r1<n-1; ++r1) { for(int c1=1; c1<m-1; ++c1) { for(int c2=c1; c2<m-1; ++c2) { vector<int>mx(m, 0); for(int r2=r1; r2<n-1; ++r2) { bool ok = true; bool dis = true; for(int j=c1; j<=c2; ++j) { ok &= a[r2][j]<min({a[r1-1][j], a[r2][c1-1], a[r2][c2+1]}); mx[j] = max(mx[j], a[r2][j]); dis &= mx[j]<a[r2+1][j]; } if(!ok) break; if(dis) ++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...