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>
#include "rect.h"
#pragma GCC optimize("O3")
using namespace std;
const int N = 2500, M = 2500;
int n, m;
long long sol;
int f[N][M];
void st5(){
for(int i = 1, mx; i < m-1; i++){
mx = 0;
for(int j = i; j < m-1; j++){
mx = max(mx, f[1][j]);
if(f[1][j] >= f[1][i-1] || f[1][j] >= f[0][j] || f[1][j] >= f[2][j]) break;
if(mx < f[1][j+1]) sol++;
}
}
}
long long count_rectangles(vector< vector<int> > a){
n = a.size(), m = a[0].size();
if(n < 3 || m < 3) return 0;
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++)
f[i][j] = a[i][j];
if(n == 3) st5();
return sol;
}
# | 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... |