/* [NWERC'08] SCULPTURE by: Jan Kuipers */ using namespace std; #include #include #include #include void compress (vector x0, vector dx, vector &i2x, map &x2i, int &X) { i2x.clear(); i2x.push_back(INT_MAX); i2x.push_back(-INT_MAX); for (int i=0; i>runs; while (runs--) { int N; cin>>N; vector x0(N),y0(N),z0(N),dx(N),dy(N),dz(N); for (int i=0; i>x0[i]>>y0[i]>>z0[i]>>dx[i]>>dy[i]>>dz[i]; int X,Y,Z; vector i2x, i2y, i2z; map x2i, y2i, z2i; compress(x0,dx,i2x,x2i,X); compress(y0,dy,i2y,y2i,Y); compress(z0,dz,i2z,z2i,Z); int a[X][Y][Z]; for (int x=0; x q; q.push(0); q.push(0); q.push(0); while (!q.empty()) { int x=q.front(); q.pop(); int y=q.front(); q.pop(); int z=q.front(); q.pop(); if (x<0 || x>=X || y<0 || y>=Y || z<0 || z>=Z) continue; if (a[x][y][z]!=2) continue; a[x][y][z]=0; for (int dx=-1; dx<=1; dx++) for (int dy=-1; dy<=1; dy++) for (int dz=-1; dz<=1; dz++) if (abs(dx)+abs(dy)+abs(dz) == 1) { q.push(x+dx); q.push(y+dy); q.push(z+dz); } } int A=0, V=0; for (int x=1; x