제출 #959519

#제출 시각아이디문제언어결과실행 시간메모리
959519NemanjaSo2005Rectangles (IOI19_rect)C++17
0 / 100
9 ms2396 KiB
#include "rect.h" #include<bits/stdc++.h> #define ll long long using namespace std; const int maxn=2505; ll res=0; int N,M,mat[maxn][maxn],maks[maxn]; bool moze[maxn]; ll prebroj(int x,int y){ ll ret=0; for(int j=y;j<=M;j++){ moze[j]=true; maks[j]=mat[x][j]; } for(int i=x;i<N;i++){ int rmaks=0; for(int j=y;j<M;j++){ rmaks=max(rmaks,mat[i][j]); moze[j]&=(rmaks<mat[i][y-1] and rmaks<mat[i][j+1]); } for(int j=y;j<M;j++) maks[j]=max(maks[j],mat[i][j]); for(int j=y;j<M;j++){ if(!moze[j]) continue; if(maks[j]>=mat[i+1][j]) continue; if(maks[j]>=mat[x-1][j]) continue; ret++; //cout<<x<<" "<<y<<" "<<i<<" "<<j<<endl; } } return ret; } ll count_rectangles(std::vector<std::vector<int> > inp) { N=inp.size(); M=inp[0].size(); for(int i=1;i<=N;i++) for(int j=1;j<=M;j++) mat[i][j]=inp[i-1][j-1]; for(int i=2;i<N;i++) for(int j=2;j<M;j++) res+=prebroj(i,j); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...