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 mini=1e9;
for (int oszlop=b; oszlop<=d; oszlop++) {
mini=min(mini, r[sor][oszlop]);
}
if (r[sor][b-1]<=mini || r[sor][d+1]<=mini) return 0;
}
for (int oszlop=b; oszlop<=d; oszlop++) {
int mini=1e9;
for (int sor=a; sor<=c; sor++) {
mini=min(mini, r[sor][oszlop]);
}
if (r[a-1][oszlop]<=mini || r[c+1][oszlop]<=mini) return 0;
}
cout << "jo " << a << " " << b << " " << c << " " << d << "\n";
return 1;
}
long long count_rectangles(vector<vector<int>> r) {
int n=r.size(), m=r[0].size(), db=0;
for (int i=1; i<n; i++) {
for (int j=i; j<n-1; j++) {
for (int k=1; k<m; k++) {
for (int l=k; l<m; 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... |