302987: CF581D. Three Logos

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Three Logos

题意翻译

### 题目描述 三家公司决定订购一个带有其标志图片的正方形广告牌。每个公司的徽标是一个非空的矩形。 只有当广告牌上可以放置所有三个徽标且不重叠、没有剩余空白时,广告商才会张贴广告。当然,徽标的两侧与广告牌的两侧平行。 您的任务是确定是否有可能在不违反任何规定的情况下,将所有三家公司的徽标放置在某个方形广告牌上。 ### 输入格式 输入的第一行包括六个正整数 $x_1,y_1,x_2,y_2,x_3,y_3 ( 1 \le x_1,y_1,x_2,y_2,x_3,y_3 \le 100)$ ,其中 $x_i$ 和 $y_i$ 表示第 i 家公司的徽标的长度和宽度。 ### 输出格式 如果如果无法将所有三个徽标放置在一个正方形盾上,请输出 $-1$ 。 如果可能,第一行输出正方形的边长 $n$ ,接下来的 $n$ 行每行包含 $n$ 个大写字母 A 、 B 或 C 。 相同字母的集合应形成实心矩形,前提是: 由字母 A 组成的矩形的大小应等于第一家公司徽标的大小,由字母 B 组成的矩形的大小应等于第二家公司徽标的大小,由字母 C 组成的矩形的大小应等于第三家公司徽标的大小, 请注意,公司的徽标可以旋转打印在广告牌上。广告牌上不得有任何空白。若一个正方形的广告牌可以用多种方式填充标识,您可输出其中的任何一种。

题目描述

Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no empty space left. When you put a logo on the billboard, you should rotate it so that the sides were parallel to the sides of the billboard. Your task is to determine if it is possible to put the logos of all the three companies on some square billboard without breaking any of the described rules.

输入输出格式

输入格式


The first line of the input contains six positive integers $ x_{1},y_{1},x_{2},y_{2},x_{3},y_{3} $ ( $ 1<=x_{1},y_{1},x_{2},y_{2},x_{3},y_{3}<=100 $ ), where $ x_{i} $ and $ y_{i} $ determine the length and width of the logo of the $ i $ -th company respectively.

输出格式


If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square $ n $ , where you can place all the three logos. Each of the next $ n $ lines should contain $ n $ uppercase English letters "A", "B" or "C". The sets of the same letters should form solid rectangles, provided that: - the sizes of the rectangle composed from letters "A" should be equal to the sizes of the logo of the first company, - the sizes of the rectangle composed from letters "B" should be equal to the sizes of the logo of the second company, - the sizes of the rectangle composed from letters "C" should be equal to the sizes of the logo of the third company, Note that the logos of the companies can be rotated for printing on the billboard. The billboard mustn't have any empty space. If a square billboard can be filled with the logos in multiple ways, you are allowed to print any of them. See the samples to better understand the statement.

输入输出样例

输入样例 #1

5 1 2 5 5 2

输出样例 #1

5
AAAAA
BBBBB
BBBBB
CCCCC
CCCCC

输入样例 #2

4 4 2 6 4 2

输出样例 #2

6
BBBBBB
BBBBBB
AAAACC
AAAACC
AAAACC
AAAACC

Input

题意翻译

### 题目描述 三家公司决定订购一个带有其标志图片的正方形广告牌。每个公司的徽标是一个非空的矩形。 只有当广告牌上可以放置所有三个徽标且不重叠、没有剩余空白时,广告商才会张贴广告。当然,徽标的两侧与广告牌的两侧平行。 您的任务是确定是否有可能在不违反任何规定的情况下,将所有三家公司的徽标放置在某个方形广告牌上。 ### 输入格式 输入的第一行包括六个正整数 $x_1,y_1,x_2,y_2,x_3,y_3 ( 1 \le x_1,y_1,x_2,y_2,x_3,y_3 \le 100)$ ,其中 $x_i$ 和 $y_i$ 表示第 i 家公司的徽标的长度和宽度。 ### 输出格式 如果如果无法将所有三个徽标放置在一个正方形盾上,请输出 $-1$ 。 如果可能,第一行输出正方形的边长 $n$ ,接下来的 $n$ 行每行包含 $n$ 个大写字母 A 、 B 或 C 。 相同字母的集合应形成实心矩形,前提是: 由字母 A 组成的矩形的大小应等于第一家公司徽标的大小,由字母 B 组成的矩形的大小应等于第二家公司徽标的大小,由字母 C 组成的矩形的大小应等于第三家公司徽标的大小, 请注意,公司的徽标可以旋转打印在广告牌上。广告牌上不得有任何空白。若一个正方形的广告牌可以用多种方式填充标识,您可输出其中的任何一种。

加入题单

算法标签: