| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 297113 | daniel920712 | Rectangles (IOI19_rect) | C++14 | 895 ms | 116620 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "rect.h"
#include <stdio.h>
using namespace std;
int can1[205][205][205]={0};
int can2[205][205][205]={0};
long long count_rectangles(vector< vector<int> > all)
{
int N,M,i,j,k,l,m,n,big=0,ok;
long long ans=0;
N=all.size();
M=all[0].size();
for(i=1;i<N;i++)
{
for(j=1;j<M;j++)
{
big=0;
for(k=j;k<M-1;k++)
{
big=max(big,all[i][k]);
if(big<all[i][j-1]&&big<all[i][k+1]) can1[i][j][k]=1;
can1[i][j][k]+=can1[i-1][j][k];
}
}
}
for(i=1;i<M;i++)
{
for(j=1;j<N;j++)
{
big=0;
for(k=j;k<N-1;k++)
{
big=max(big,all[k][i]);
if(big<all[j-1][i]&&big<all[k+1][i]) can2[i][j][k]=1;
can2[i][j][k]+=can2[i-1][j][k];
}
}
}
for(i=1;i<N-1;i++)
{
for(j=i;j<N-1;j++)
{
for(k=1;k<M-1;k++)
{
for(l=k;l<M-1;l++)
{
//ok=1;
if(can1[j][k][l]-can1[i-1][k][l]==j-i+1&&can2[l][i][j]-can2[k-1][i][j]==l-k+1) ans++;
//for(m=i;m<=j;m++) ok=ok&&can1[m][k][l];
//for(m=k;m<=l;m++) ok=ok&&can2[m][i][j];
//if(ok) ans++;
}
}
}
}
return ans;
}
Compilation message (stderr)
| # | 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... | ||||
