# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
18590 | eaststar | 일도양단! (kriii1_1) | C++14 | 1 ms | 2108 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 <stdio.h>
#include <algorithm>
using namespace std;
int a[8][8][8],b[8][8][8][8][8][8];
int f(int sr,int er,int sc,int ec,int sh,int eh){
int i,j,k,s=0,t,&mx=b[sr][er][sc][ec][sh][eh];
if(mx)return mx;
for(i=sr;i<=er;++i)for(j=sc;j<=ec;++j)for(k=sh;k<=eh;++k)s+=a[i][j][k];
if(!s)return 0;
if(s==1)return mx=(er-sr+1)*(ec-sc+1)*(eh-sh+1);
for(i=sr;i<er;++i)mx=max(mx,min(f(sr,i,sc,ec,sh,eh),f(i+1,er,sc,ec,sh,eh)));
for(i=sc;i<ec;++i)mx=max(mx,min(f(sr,er,sc,i,sh,eh),f(sr,er,i+1,ec,sh,eh)));
for(i=sh;i<eh;++i)mx=max(mx,min(f(sr,er,sc,ec,sh,i),f(sr,er,sc,ec,i+1,eh)));
return mx;
}
int main(){
int r,c,h,n,x,y,z;
scanf("%d%d%d%d",&r,&c,&h,&n);
for(;n--;)scanf("%d%d%d",&x,&y,&z),a[x][y][z]=1;
printf("%d",f(1,r,1,c,1,h));
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |