# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
941444 | Programmer123 | Rectangles (IOI19_rect) | C++17 | 1 ms | 348 KiB |
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"
long long count_rectangles(std::vector<std::vector<int> > a) {
int N = a.size();
int M = a[0].size();
long long ans = 0;
if (N == 3) {
bool works[N];
works[0] = false;
works[N - 1] = false;
for (int i = 1; i < N - 1; ++i) {
works[i] = a[1][i] < a[0][i] && a[1][i] < a[2][i];
}
for (int l = 1; l < N - 1; ++l) {
if (!works[l]) continue;
int max = a[1][l];
for (int r = l; r < N - 1; ++r) {
if (!works[r]) break;
max = std::max(max, a[1][r]);
if (max >= a[1][l - 1]) break;
if (max >= a[1][r + 1]) continue;
ans++;
}
}
}
return ans;
}
Compilation message (stderr)
# | 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... |