Submission #423307

#TimeUsernameProblemLanguageResultExecution timeMemory
423307MonchitoRectangles (IOI19_rect)C++14
37 / 100
5070 ms28228 KiB
#include "rect.h" using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; int n, m; bool can(int r1, int r2, int c1, int c2, vvi& a){ for(int i=r1; i<=r2; i++){ for(int j=c1; j<=c2; j++){ if(a[i][j] >= a[i][c1-1] || a[i][j] >= a[i][c2+1]) return false; if(a[i][j] >= a[r1-1][j] || a[i][j] >= a[r2+1][j]) return false; } } return true; } ll count_rectangles(vvi a) { ll ret = 0; n = a.size(); m = a[0].size(); 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<m-1; c2++){ if(can(r1, r2, c1, c2, a)) ret++; } } } } return ret; }
#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...