답안 #19160

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19160 2016-02-19T06:05:43 Z Namnamseo 일도양단! (kriii1_1) C++14
1 / 1
17 ms 2364 KB
#include <cstdio>

int x,y,z;

int nx[100];
int ny[100];
int nz[100];
int n;

int cube(int a,int b,int c,int d,int e,int f){
    int ret=0, i;
    for(i=0;i<n;++i){
        if(a<=nx[i] && nx[i]<=b &&
           c<=ny[i] && ny[i]<=d &&
           e<=nz[i] && nz[i]<=f) ++ret;
    }
    return ret;
}

int  dp[8][8][8][8][8][8];
bool dc[8][8][8][8][8][8];

template<typename T> inline T max(T a,T b){ return b<a?a:b; }
template<typename T> inline T min(T a,T b){ return a<b?a:b; }

int work(int a,int b,int c,int d,int e,int f){
    int myn = cube(a,b,c,d,e,f);
    if(myn==1) return (b-a+1)*(d-c+1)*(f-e+1);
    if(dc[a][b][c][d][e][f]) return dp[a][b][c][d][e][f];
    dc[a][b][c][d][e][f]=1;
    int& ret=dp[a][b][c][d][e][f];
    int i;
    for(i=a;i<b;++i) ret=max(ret, min( work(a,i,c,d,e,f), work(i+1,b,c,d,e,f) ));
    for(i=c;i<d;++i) ret=max(ret, min( work(a,b,c,i,e,f), work(a,b,i+1,d,e,f) ));
    for(i=e;i<f;++i) ret=max(ret, min( work(a,b,c,d,e,i), work(a,b,c,d,i+1,f) ));
    return ret;
}

int main()
{
    scanf("%d%d%d",&x,&y,&z);
    scanf("%d",&n);
    int i;
    for(i=0;i<n;++i) {
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        nx[i]=a;
        ny[i]=b;
        nz[i]=c;
    }
    printf("%d\n",work(1,x,1,y,1,z));
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 2364 KB Output is correct
2 Correct 0 ms 2364 KB Output is correct
3 Correct 0 ms 2364 KB Output is correct
4 Correct 3 ms 2364 KB Output is correct
5 Correct 0 ms 2364 KB Output is correct
6 Correct 0 ms 2364 KB Output is correct
7 Correct 0 ms 2364 KB Output is correct
8 Correct 5 ms 2364 KB Output is correct
9 Correct 0 ms 2364 KB Output is correct
10 Correct 0 ms 2364 KB Output is correct
11 Correct 6 ms 2364 KB Output is correct
12 Correct 0 ms 2364 KB Output is correct
13 Correct 0 ms 2364 KB Output is correct
14 Correct 5 ms 2364 KB Output is correct
15 Correct 0 ms 2364 KB Output is correct
16 Correct 0 ms 2364 KB Output is correct
17 Correct 0 ms 2364 KB Output is correct
18 Correct 0 ms 2364 KB Output is correct
19 Correct 0 ms 2364 KB Output is correct
20 Correct 0 ms 2364 KB Output is correct
21 Correct 0 ms 2364 KB Output is correct
22 Correct 0 ms 2364 KB Output is correct
23 Correct 0 ms 2364 KB Output is correct
24 Correct 10 ms 2364 KB Output is correct
25 Correct 0 ms 2364 KB Output is correct
26 Correct 17 ms 2364 KB Output is correct
27 Correct 0 ms 2364 KB Output is correct
28 Correct 8 ms 2364 KB Output is correct
29 Correct 0 ms 2364 KB Output is correct
30 Correct 0 ms 2364 KB Output is correct
31 Correct 0 ms 2364 KB Output is correct
32 Correct 0 ms 2364 KB Output is correct
33 Correct 0 ms 2364 KB Output is correct
34 Correct 0 ms 2364 KB Output is correct
35 Correct 0 ms 2364 KB Output is correct
36 Correct 0 ms 2364 KB Output is correct
37 Correct 0 ms 2364 KB Output is correct
38 Correct 0 ms 2364 KB Output is correct
39 Correct 0 ms 2364 KB Output is correct
40 Correct 0 ms 2364 KB Output is correct
41 Correct 0 ms 2364 KB Output is correct
42 Correct 0 ms 2364 KB Output is correct
43 Correct 8 ms 2364 KB Output is correct
44 Correct 0 ms 2364 KB Output is correct
45 Correct 0 ms 2364 KB Output is correct
46 Correct 0 ms 2364 KB Output is correct
47 Correct 0 ms 2364 KB Output is correct
48 Correct 1 ms 2364 KB Output is correct
49 Correct 0 ms 2364 KB Output is correct
50 Correct 0 ms 2364 KB Output is correct
51 Correct 0 ms 2364 KB Output is correct
52 Correct 0 ms 2364 KB Output is correct
53 Correct 0 ms 2364 KB Output is correct
54 Correct 0 ms 2364 KB Output is correct
55 Correct 0 ms 2364 KB Output is correct
56 Correct 0 ms 2364 KB Output is correct
57 Correct 0 ms 2364 KB Output is correct
58 Correct 0 ms 2364 KB Output is correct
59 Correct 0 ms 2364 KB Output is correct
60 Correct 0 ms 2364 KB Output is correct
61 Correct 0 ms 2364 KB Output is correct
62 Correct 0 ms 2364 KB Output is correct
63 Correct 0 ms 2364 KB Output is correct
64 Correct 0 ms 2364 KB Output is correct
65 Correct 0 ms 2364 KB Output is correct
66 Correct 0 ms 2364 KB Output is correct
67 Correct 0 ms 2364 KB Output is correct
68 Correct 1 ms 2364 KB Output is correct
69 Correct 0 ms 2364 KB Output is correct
70 Correct 0 ms 2364 KB Output is correct
71 Correct 0 ms 2364 KB Output is correct
72 Correct 3 ms 2364 KB Output is correct
73 Correct 0 ms 2364 KB Output is correct
74 Correct 0 ms 2364 KB Output is correct
75 Correct 0 ms 2364 KB Output is correct
76 Correct 0 ms 2364 KB Output is correct
77 Correct 0 ms 2364 KB Output is correct
78 Correct 1 ms 2364 KB Output is correct
79 Correct 4 ms 2364 KB Output is correct
80 Correct 0 ms 2364 KB Output is correct
81 Correct 0 ms 2364 KB Output is correct
82 Correct 0 ms 2364 KB Output is correct
83 Correct 2 ms 2364 KB Output is correct
84 Correct 0 ms 2364 KB Output is correct
85 Correct 0 ms 2364 KB Output is correct
86 Correct 1 ms 2364 KB Output is correct
87 Correct 0 ms 2364 KB Output is correct
88 Correct 0 ms 2364 KB Output is correct
89 Correct 2 ms 2364 KB Output is correct
90 Correct 3 ms 2364 KB Output is correct
91 Correct 0 ms 2364 KB Output is correct
92 Correct 0 ms 2364 KB Output is correct
93 Correct 0 ms 2364 KB Output is correct
94 Correct 5 ms 2364 KB Output is correct
95 Correct 0 ms 2364 KB Output is correct
96 Correct 0 ms 2364 KB Output is correct
97 Correct 3 ms 2364 KB Output is correct
98 Correct 0 ms 2364 KB Output is correct
99 Correct 6 ms 2364 KB Output is correct
100 Correct 0 ms 2364 KB Output is correct