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 <bits/stdc++.h>
using namespace std;
long long count_rectangles(std::vector<std::vector<int>> a)
{
int n = a.size();
int m = a[0].size();
if(n < 3 || m < 3) return 0;
vector<int> valid(m);
for(int i = 0; i < m; i++)
{
valid[i] = (a[0][i] > a[1][i]) && (a[2][i] > a[1][i]);
}
long long res = 0;
for(int start = 1; start < m-1; start++){
int ma = a[1][start];
for(int end = start; end < m-1; end++){
ma = max(ma, a[1][end]);
if(a[1][start-1] <= ma) break;
if(a[1][end+1] <= ma) {
continue;
}
if(!valid[end]) break;
res++;
end++;
ma = max(ma, a[1][end]);
}
}
return res;
}
# | 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... |