| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 (추가 시간 없음) | 1024 MB | 58 | 35 | 32 | 82.051% |
The Menger sponge is a simple 3D fractal. Its level-$L$ approximation can be constructed with the following algorithm:
The points in the level-$L$ Menger sponge are those that remain after running the above algorithm. Points exactly on the boundary of cubes that remain in the sponge are part of the sponge.
The picture below shows the result for $L=0$ through $L=3$:
Given a level $L$ and a point in space given by three rational coordinates, determine if the point is in the level-$L$ Menger sponge.
The single line of input contains seven integers $L,ドル $x_{\text{num}},ドル $x_{\text{denom}},ドル $y_{\text{num}},ドル $y_{\text{denom}},ドル $z_{\text{num}},ドル $z_{\text{denom}}$:
where $L$ is the level of the Menger Sponge and the point in question is $\displaystyle\left(\frac{x_{\text{num}}}{x_{\text{denom}}}, \frac{y_{\text{num}}}{y_{\text{denom}}}, \frac{z_{\text{num}}}{z_{\text{denom}}}\right)$.
Output a single integer, which is 1ドル$ if the point is in the level-$L$ Menger Sponge, or 0ドル$ if not.
1000 1 3 1 3 1 3
1
2 49 81 5 6 20 81
1
3 49 81 5 6 20 81
0