프로그램 명: boi_lego
제한시간: 1 초

You are using Lego building blocks to train an artificial vision system. Write a program that, given pictures of a Lego construction taken from two angles, calculates in how many difierent ways it can be built.

In this task, there is only one kind of lego block (with 2 × 2 “knobs”, see picture below), but it can have three difierent colors: white (W), gray (G) or black (B). All blocks exist in unlimited amounts. You use a quadratic base with 6 × 6 knobs. Every block must have its edges parallel to this base and no block may extend outside of it. Every block must rest upon at least one underlying block.

Left: An allowed way to place a block on top of another one. Center: An illegal way (the upper block hangs in the air). Right: Another illegal way (the upper block extends outside the base).

입력

The first picture is followed by another set of H lines with the construction seen from an angle where the observer has moved 90 degrees counterclockwise around the construction (marked B on the figure below).

출력

The program should output one line , containing a single integer: the number of difierent Lego constructions that satisfy the pictures given in the input. Note that even if two difierent possible constructions could be obtained from each other by rotating or mirroring, they both should be counted. For the given input, the answer will always fit in a signed 64-bit integer.

입출력 예

입력

2
WWGG..
.BB.WW
.WGG..
WWGG..

출력

6
One of the possible constructions in the example.

출처:boi 2010 day1 2/3

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]