Farmer John's Cheese Block
시간 제한2초메모리 제한2048 MB
N×N×N 치즈 덩어리에서 단위 정육면체를 하나씩 제거하며, 매번 빈 공간에 길이 N인 1×1×N 막대를 축 방향으로 놓을 수 있는 위치의 수를 센다.
문제
Farmer John has a block of cheese in the shape of a cube. It lies on the 3-dimensional coordinate plane, extending from to (). Farmer John will perform a series of () update operations to his cheese block.
For each update operation, FJ will carve out the by by block of cheese extending from integer coordinates to , where . It is guaranteed that there will exist a by by block of cheese at the location FJ carves. Since FJ is playing Moocraft, gravity does not cause parts of the cheese to fall if cheese below is carved.
After each update, output the number of distinct configurations that FJ can stick a by by brick in the cheese block such that no part of the brick overlaps with any remaining cheese. Every vertex of the brick must have integer coordinates in the range for all three axes. FJ may rotate the brick however he wants.
입력
The first line contains and .
The following lines contain , , and , the coordinates to be carved.
출력
After each update operation, output an integer, the number of configurations.
힌트
After the first three updates, the brick spanning does not overlap with the remaining cheese, so it contributes toward the answer.
