아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Image is Everything

시간 제한2초메모리 제한512 MB

요약
N x N x N 격자로 이루어진 물체의 여섯 방향 직교 투영 색상 뷰가 주어질 때, 물체가 가질 수 있는 단위 큐브 개수의 최댓값을 구합니다.
난이도

보통10점 중 6점

유형
시뮬레이션, 구현, 행렬
정답자
아직 제출이 없습니다

문제

Your new company is building a robot that can hold small lightweight objects. The robot will have the intelligence to determine if an object is light enough to hold. It does this by taking pictures of the object from the 6 cardinal directions, and then inferring an upper limit on the object’s weight based on those images. You must write a program to do that for the robot.

You can assume that each object is formed from an N × N × N lattice of cubes, some of which may be missing. Each 1 × 1 × 1 cube weighs 1 gram, and each cube is painted a single solid color. The object is not necessarily connected.

입력

The input for this problem consists of several test cases representing different objects. Every case begins with a line containing N, which is the size of the object (1 ≤ N ≤ 10). The next N lines are the different N × N views of the object, in the order front, left, back, right, top, bottom. Each view will be separated by a single space from the view that follows it. The bottom edge of the top view corresponds to the top edge of the front view. Similarly, the top edge of the bottom view corresponds to the bottom edge of the front view. In each view, colors are represented by single, unique capital letters, while a period (.) indicates that the object can be seen through at that location.

Input for the last test case is followed by a line consisting of the number 0.

출력

For each test case, print a line containing the maximum possible weight of the object, using the format shown below.

예제1

  1. 예제 1

    입력
    3
    .R. YYR .Y. RYY .Y. .R.
    GRB YGR BYG RBY GYB GRB
    .R. YRR .Y. RRY .R. .Y.
    2
    ZZ ZZ ZZ ZZ ZZ ZZ
    ZZ ZZ ZZ ZZ ZZ ZZ
    0
    
    예상 출력
    Maximum weight: 11 gram(s)
    Maximum weight: 8 gram(s)