Submission #3334

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
33342013-08-30 12:27:55The_KMJ_God일도양단! (kriii1_1)C++98
1 / 1
0 ms2700 KiB
// Problem 1. !
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<memory.h>
using namespace std;
bool Raisin[8][8][8];
int R,C,H,n,r,c,h;
int dp[8][8][8][8][8][8];
int sum[8][8][8];
int FUNCTION(int a, int b, int c, int d, int e, int f, int cnt) {
if ( cnt==1 ) return (d-a+1)*(e-b+1)*(f-c+1);
if ( dp[a][b][c][d][e][f]!=-1 ) return dp[a][b][c][d][e][f];
int i,j,maximum=-1,kkk;
for ( i=a; i<d; i++ ) {
for ( j=c,kkk=0; j<=f; j++ ) {
kkk+=(sum[i][e][j]-sum[a-1][e][j]-sum[i][b-1][j]+sum[a-1][b-1][j]);
}
if ( kkk!=0 && kkk!=cnt ) maximum = max ( maximum , min( FUNCTION(a,b,c,i,e,f,kkk) , FUNCTION(i+1,b,c,d,e,f,cnt-kkk) ) );
}
for ( i=b; i<e; i++ ) {
for ( j=c,kkk=0; j<=f; j++ ) {
kkk+=(sum[d][i][j]-sum[a-1][i][j]-sum[d][b-1][j]+sum[a-1][b-1][j]);
}
if ( kkk!=0 && kkk!=cnt )
maximum = max ( maximum , min( FUNCTION(a,b,c,d,i,f,kkk) , FUNCTION(a,i+1,c,d,e,f,cnt-kkk) ) );
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...