이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rect.h"
#include <bits/stdc++.h>
using namespace std;
int a[2501][2501];
long long count_rectangles(std::vector<std::vector<int> > A) {
long long ans = 0;
for(int i = 0;i<A.size();i++){
for(int j = 0;j<A[i].size();j++) a[i][j] = A[i][j];
}
int n = A.size();
int m = A[0].size();
map<pair<pair<int,int>,pair<int,int> > ,bool > mp;
for(int i = 1;i<n-1;i++){
for(int j = 1;j<m-1;j++){
for(int k = j;k<m-1;k++){
for(int ii = i;ii<n-1;ii++){
bool f = true;
for(int jj = j;jj<=k;jj++){
if(a[ii][jj]>=a[ii][j-1] || a[ii][jj]>=a[ii][k+1]){
f = false;
break;
}
}
if(!f) break;
pair<int,int> x = {i,j};
pair<int,int> y = {ii,k};
mp[{x,y}] = true;
}
}
}
}
for(int i = 1;i<n-1;i++){
for(int j = 1;j<m-1;j++){
for(int k = i;k<n-1;k++){
for(int jj = j;jj<m-1;jj++){
bool f = true;
for(int ii = i;ii<=k;ii++){
if(a[ii][jj]>=a[i-1][jj] || a[ii][jj]>=a[k+1][jj]){
f = false;
break;
}
}
if(!f) break;
pair<int,int> x = {i,j};
pair<int,int> y = {k,jj};
if(mp[{x,y}]) ans++;
}
}
}
}
return ans;
//return 1;
}
컴파일 시 표준 에러 (stderr) 메시지
rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:8:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i<A.size();i++){
~^~~~~~~~~
rect.cpp:9:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0;j<A[i].size();j++) a[i][j] = A[i][j];
~^~~~~~~~~~~~
# | 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... |