This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "rect.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
long long count_rectangles(vector<vector<int> > a) {
int n = a.size();
int m = a[0].size();
vector<vector<bool>> b(n, vector<bool>(m, 0));
ll ans = 0;
for (int i = 1; i < n-1; ++i) {
for (int j = 1; j < m-1; ++j) {
if (a[i-1][j] <= a[i][j]) continue;
if (a[i][j-1] <= a[i][j]) continue;
for (int p = i; p < n-1; ++p) {
if (a[p][j-1] <= a[p][j]) break;
for (int q = j; q < m-1; ++q) {
if (a[i-1][q] <= a[i][q]) break;
if (a[p+1][q] <= a[p][q]) break;
if (a[p][q+1] <= a[p][q]) break;
ans++;
//cout << i << " " << j << " " << p << " " << q << "\n";
}
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |