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;
bool jo(int a, int b, int c, int d, vector<vector<int>> &r) {
// (a, b) a bal felso, (c, d) a jobb also sarok
for (int sor=a; sor<=c; sor++) {
int maxi=0;
for (int oszlop=b; oszlop<=d; oszlop++) {
maxi=max(maxi, r[sor][oszlop]);
}
if (r[sor][b-1]<=maxi || r[sor][d+1]<=maxi) return 0;
}
for (int oszlop=b; oszlop<=d; oszlop++) {
int maxi=0;
for (int sor=a; sor<=c; sor++) {
maxi=max(maxi, r[sor][oszlop]);
}
if (r[a-1][oszlop]<=maxi || r[c+1][oszlop]<=maxi) return 0;
}
//cout << "jo " << a << " " << b << " " << c << " " << d << "\n";
return 1;
}
long long count_rectangles(vector<vector<int>> r) {
// 1, 2, 5-re mukodik
int n=r.size(), m=r[0].size(), db=0;
for (int i=1; i<n-1; i++) {
for (int j=i; j<n-1; j++) {
for (int k=1; k<m-1; k++) {
for (int l=k; l<m-1; l++) {
if (jo(i, k, j, l, r)) {
db++;
}
}
}
}
}
return db;
}
# | 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... |