Submission #380018

#TimeUsernameProblemLanguageResultExecution timeMemory
380018SuhaibSawalha1Rectangles (IOI19_rect)C++17
10 / 100
84 ms23020 KiB
#include "rect.h" #include <bits/stdc++.h> using namespace std; long long count_rectangles(vector<vector<int>> a) { int n = a.size(), m = a[0].size(); long long ans = 0; for (int x = 1; x < n - 1; ++x) { for (int y = 1; y < m - 1; ++y) { for (int i = x; i < n - 1; ++i) { if (a[i][y] >= a[i][y - 1] || a[i][y] >= a[x - 1][y]) { break; } bool bad = 0; for (int j = y; j < m - 1 && !bad; ++j) { bool good = 1; for (int l = x; l <= i && good; ++l) { for (int r = y; r <= j && good; ++r) { good &= a[l][r] < a[l][j + 1] && a[l][r] < a[i + 1][r] && a[l][r] < a[l][y - 1] && a[l][r] < a[x - 1][r]; bad |= a[l][r] >= a[l][y - 1] || a[l][r] >= a[x - 1][r] || a[l][r] >= a[l + 1][r]; } } ans += good; } } } } 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...