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>
#ifdef __LOCAL__
#include <debug_local.h>
#endif
using namespace std;
long long count_rectangles(vector<vector<int>> a) {
long long ans = 0;
int n = a.size();
int m = a[0].size();
if (n <= 2) return 0;
if (m <= 2) return 0;
if (n <= 3) {
vector<int> ok(m);
for (int i = 1; i < n - 1; i++) ok[i] = (a[0][i] > a[1][i] && a[2][i] > a[1][i]);
for (int i = 1; i < n - 1; i++) {
int cur_max = 0;
for (int j = i; j < n - 1; j++) {
if (!ok[j]) break;
cur_max = max(cur_max, a[1][j]);
if (a[1][i - 1] > cur_max && a[1][j + 1] > cur_max) ans++;
}
}
return ans;
}
return 0;
}
# | 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... |