이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#include "rect.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool check(vector<vector<int> >& board,int a,int b,int c,int d)
{
//cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
for(int i=a;i<=b;i++){
for(int j=c;j<=d;j++){
//cout<<i<<" "<<j<<board[i][j]<<endl;
if(board[i][c-1]<=board[i][j])
return false;
if(board[i][d+1]<=board[i][j])
return false;
if(board[a-1][j]<=board[i][j])
return false;
if(board[b+1][j]<=board[i][j])
return false;
}
}
return true;
}
ll count_rectangles(vector<vector<int> > a) {
int n=a.size();
int m=a[0].size();
ll total=0;
for(int i=1;i<n-1;i++){
for(int j=1;j<m-1;j++){
for(int i2=i;i2<n-1;i2++){
for(int j2=j;j2<m-1;j2++){
if(check(a,i,i2,j,j2)) total++;//cout<<i<<" "<<i2<<" "<<j<<" "<<j2<<endl;
}
}
}
}
return total;
}
# | 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... |