이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define N 2500
int l[N][N];
int u[N][N];
int r[N][N];
int d[N][N];
ll count_rectangles(vector<vector<int>> a){
int n,m;
n=a.size();
m=a[0].size();
for(int i=1;i<n-1;i++){
for(int j=1;j<m-1;j++){
l[i][j]=l[i-1][j]+(a[i][j]<a[i][j-1]);
u[i][j]=u[i][j-1]+(a[i][j]<a[i-1][j]);
r[i][j]=r[i-1][j]+(a[i][j]<a[i][j+1]);
d[i][j]=d[i][j-1]+(a[i][j]<a[i+1][j]);
}
}
ll o=0;
for(int i1=1;i1<n-1;i1++){
for(int j1=1;j1<m-1;j1++){
for(int i2=i1;i2<n-1;i2++){
for(int j2=j1;j2<m-1;j2++){
if(l[i2][j1]-l[i1-1][j1]==i2-i1+1
&& u[i1][j2]-u[i1][j1-1]==j2-j1+1
&& r[i2][j2]-r[i1-1][j2]==i2-i1+1
&& d[i2][j2]-d[i2][j1-1]==j2-j1+1){
o++;
}
}
}
}
}
return o;
}
# | 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... |