Submission #415322

#TimeUsernameProblemLanguageResultExecution timeMemory
415322peuchRectangles (IOI19_rect)C++17
0 / 100
45 ms12876 KiB
#include "rect.h" #include<bits/stdc++.h> using namespace std; const int MAXN = 710; bitset<MAXN> lVal[MAXN][MAXN]; bitset<MAXN> cVal[MAXN][MAXN]; long long count_rectangles(std::vector<std::vector<int> > a) { int n = a.size(); int m = a[0].size(); for(int i = 1; i < n - 1; i++){ for(int j = 1; j < m - 1; j++){ int maxi = 0; for(int k = j; k < m - 1; k++){ maxi = max(maxi, a[i][k]); lVal[i][j][k] = maxi < a[i][j - 1] && maxi < a[i][k + 1]; } } } for(int i = 1; i < m - 1; i++){ for(int j = 1; j < n - 1; j++){ int maxi = 0; for(int k = j; k < n - 1; k++){ maxi = max(maxi, a[k][i]); cVal[i][j][k] = maxi < a[j - 1][i] && maxi < a[k + 1][i]; } } } long long ans = 0; for(int i = 1; i < n - 1; i++){ for(int j = 1; j < m - 1; j++){ vector<int> marc (m, true); for(int k = i; k < n - 1; k++){ for(int l = j; l < m - 1; l++){ marc[l] &= lVal[k][j][l]; if(marc[l] == 0) continue; if(cVal[l][i][k] == 0) continue; 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...