이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rect.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(int i = a; i < b; i++)
const int MX = 205;
int n,m,A[MX][MX];
bitset<MX> hor[MX][MX],ver[MX][MX];
bitset<MX> gg[MX];
ll count_rectangles(vector<vi> a) {
n = a.size();
m = a[0].size();
REP(i,n) REP(j,m) A[i][j] = a[i][j];
REP(i,n){
REP(j,m){
int mx = -1;
FOR(k,j,m){
mx = max(mx,a[i][k]);
hor[j][k][i] = (j and k < m-1 and mx < min(a[i][j-1],a[i][k+1]));
}
}
}
REP(j,m){
REP(i,n){
int mx = -1;
FOR(k,i,n){
mx = max(mx,a[k][j]);
ver[i][k][j] = (i and k < n-1 and mx < min(a[i-1][j],a[k+1][j]));
}
}
}
ll ans = 0;
REP(i1,n){
REP(j1,m){
FOR(i2,i1,n){
gg[i2].reset();
}
FOR(i2,i1,n){
FOR(j2,j1,m){
if(!ver[i1][i2][j2]) break;
gg[i2][j2] = 1;
}
}
FOR(j2,j1,m){
FOR(i2,i1,n){
if(!hor[j1][j2][i2]) break;
ans += gg[i2][j2];
}
}
}
}
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... |