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 sz(x) (int)x.size()
using namespace std;
long long count_rectangles(vector<vector<int>> a) {
int n = sz(a);
int m = sz(a[0]);
if (n <= 2 || m <= 2) {
return 0;
}
if (n == 3) {
long long res = 0;
for (int l = 0; l < m; l++) {
int mx = -1e9;
for (int r = l + 1; r < m; r++) {
if (r - l > 1) {
if (mx < a[1][l] && mx < a[1][r]) {
res++;
}
}
mx = max(mx, a[1][r]);
}
}
return res;
}
return 0;
}
/*
g++ -std=gnu++14 -O2 -Wall -pipe -static -o "rect" "grader.cpp" "rect.cpp"
*/
# | 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... |