Submission #379998

#TimeUsernameProblemLanguageResultExecution timeMemory
379998SuhaibSawalha1Rectangles (IOI19_rect)C++14
13 / 100
2884 ms61804 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) { bool bad = 0; for (int i = x; i < n - 1 && !bad; ++i) { for (int j = y; j < m - 1; ++j) { if (a[i][y] >= a[i][y - 1]) { bad = 1; break; } if (a[i][j] >= a[x - 1][j] || a[i][j] >= a[i + 1][j]) { break; } bool good = 1; for (int l = x; l <= i; ++l) { for (int r = y; r <= j; ++r) { good &= a[l][r] < a[l][j + 1]; } } 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...