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>
using namespace std;
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define lli long long int
#define debug(a) cout << #a << " = " << a << endl
struct x{
lli fila;
lli colu;
};
lli visitados[2502][2502];
lli arr[2500][2500],MAXf[2500],MAXc[2500];
lli fil,col,res,cont;
bool bci, bfi, bff, bcf, ok;
long long count_rectangles(std::vector<std::vector<int> > a) {
fil = a.size();
col = a[0].size();
rep(i,0,fil-1) {
rep(j,0,col-1) {
arr[i][j] = a[i][j];
}
}
cont = 0;
res = 0;
rep(ci, 1, col-2) {
rep(fi, 1, fil-2) {
rep(ff, fi, fil - 2) {
rep(i, fi, ff) MAXf[i] = 0;
bcf = false;
rep(cf, ci, col - 2) {
ok = true;
MAXc[cf] = 0;
rep(i, fi, ff) {
MAXf[i] = max(MAXf[i], arr[i][cf]);
if (arr[i][ci - 1] <= MAXf[i]) {
bcf = true;
ok = false;
break;
}
if (arr[i][cf + 1] <= MAXf[i]) ok = false;
MAXc[cf] = max(MAXc[cf], arr[i][cf]);
}
if (arr[fi - 1][cf] <= MAXc[cf] || arr[ff + 1][cf] <= MAXc[cf]){
break;
}
else if (ok) res++;
if (bcf) break;
}
}
}
}
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... |