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 ll long long
#define FOR(i, a, b) for(int i=a;i<=(b - 1);i++)
using namespace std;
ll count_rectangles(vector<vector<int>> a) {
int n = a.size(), m = a[0].size();
ll ans = 0;
FOR(a1, 1, n - 1)
{
FOR(b1, 1, m - 1)
{
FOR(a2, a1, n - 1)
{
if(a[a2][b1] >= a[a1 - 1][b1] || a[a2][b1] >= a[a2][b1 - 1])
break;
int further = 0;
FOR(b2, b1, m - 1)
{
if(further)
break;
int can = 1;
FOR(i, a1, a2 + 1)
{
if(!can)
break;
FOR(j, b1, b2 + 1)
{
if(!can)
break;
if(a[i][j] >= a[a1 - 1][j] || a[i][j] >= a[i][b1 - 1] || a[i][j] >= a[a2 + 1][j] || a[i][j] >= a[i][b2 + 1])
can = 0;
if(!can)
further = (a[i][j] >= a[a1 - 1][j] || a[i][j] >= a[i][b1 - 1] || a[i][j] >= a[a2 + 1][j]);
}
}
ans += can;
}
}
}
}
return ans;
}
# | 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... |