A. Brain's Photos

Codeforces
IDCF707A
Time2000ms
Memory256MB
Difficulty
implementation
English · Original
Chinese · Translation
Formal · Original
Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead. As you may know, the coolest photos are on the film (because you can specify the hashtag #film for such). Brain took a lot of colourful pictures on colored and black-and-white film. Then he developed and translated it into a digital form. But now, color and black-and-white photos are in one folder, and to sort them, one needs to spend more than one hour! As soon as Brain is a photographer not programmer now, he asks you to help him determine for a **single** photo whether it is colored or black-and-white. Photo can be represented as a matrix sized _n_ × _m_, and each element of the matrix stores a symbol indicating corresponding pixel color. There are only 6 colors: * 'C' (cyan) * 'M' (magenta) * 'Y' (yellow) * 'W' (white) * 'G' (grey) * 'B' (black) The photo is considered black-and-white if it has only white, black and grey pixels in it. If there are any of cyan, magenta or yellow pixels in the photo then it is considered colored. ## Input The first line of the input contains two integers _n_ and _m_ (1 ≤ _n_, _m_ ≤ 100) — the number of photo pixel matrix rows and columns respectively. Then _n_ lines describing matrix rows follow. Each of them contains _m_ space-separated characters describing colors of pixels in a row. Each character in the line is one of the 'C', 'M', 'Y', 'W', 'G' or 'B'. ## Output Print the "#Black&White" (without quotes), if the photo is black-and-white and "#Color" (without quotes), if it is colored, in the only line. [samples]
小但非常勇敢的老鼠 Brain 没有被录取进入年轻反派的暑期学校。他感到沮丧,决定推迟征服世界的计划,转而成为一名摄影师。 正如你所知,最酷的照片是在胶片上的(因为你可以为这样的照片添加标签 #film)。 Brain 在彩色和黑白胶片上拍摄了大量彩色照片。然后他将这些照片冲洗并转换为数字格式。但现在,彩色和黑白照片混在同一个文件夹中,要将它们分类需要花费一个多小时! 由于 Brain 现在是一名摄影师而非程序员,他请你帮助他判断一张*单张*照片是彩色的还是黑白的。 照片可以用一个大小为 #cf_span[n × m] 的矩阵表示,矩阵中的每个元素表示对应像素的颜色。共有 #cf_span[6] 种颜色: 如果照片中仅包含白色、黑色和灰色像素,则认为它是黑白的;如果照片中包含任何青色、品红或黄色像素,则认为它是彩色的。 输入的第一行包含两个整数 #cf_span[n] 和 #cf_span[m](#cf_span[1 ≤ n, m ≤ 100])——分别表示照片像素矩阵的行数和列数。 接下来是 #cf_span[n] 行,每行描述矩阵的一行。每行包含 #cf_span[m] 个用空格分隔的字符,表示该行中每个像素的颜色。每行中的每个字符都是 'C'、'M'、'Y'、'W'、'G' 或 'B' 之一。 如果照片是黑白的,请在一行中输出 "#Black&White"(不含引号);如果是彩色的,请输出 "#Color"(不含引号)。 ## Input 输入的第一行包含两个整数 #cf_span[n] 和 #cf_span[m](#cf_span[1 ≤ n, m ≤ 100])——分别表示照片像素矩阵的行数和列数。接下来是 #cf_span[n] 行,每行描述矩阵的一行。每行包含 #cf_span[m] 个用空格分隔的字符,表示该行中每个像素的颜色。每行中的每个字符都是 'C'、'M'、'Y'、'W'、'G' 或 'B' 之一。 ## Output 如果照片是黑白的,请在一行中输出 "#Black&White"(不含引号);如果是彩色的,请输出 "#Color"(不含引号)。 [samples]
**Definitions** Let $ n, m \in \mathbb{Z} $ denote the dimensions of the pixel matrix, with $ 1 \leq n, m \leq 100 $. Let $ P \in \{C, M, Y, W, G, B\}^{n \times m} $ be the matrix representing the photo, where each entry is a color character. **Constraints** Each element $ P_{i,j} \in \{C, M, Y, W, G, B\} $ for all $ i \in \{1, \dots, n\} $, $ j \in \{1, \dots, m\} $. **Objective** Determine: $$ \text{Output} = \begin{cases} \text{"\#Black\&White"} & \text{if } \forall i,j,\ P_{i,j} \in \{W, G, B\} \\ \text{"\#Color"} & \text{otherwise} \end{cases} $$
Samples
Input #1
2 2
C M
Y Y
Output #1
#Color
Input #2
3 2
W W
W W
B B
Output #2
#Black&White
Input #3
1 1
W
Output #3
#Black&White
API Response (JSON)
{
  "problem": {
    "name": "A. Brain's Photos",
    "description": {
      "content": "Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead. ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF707A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead.\n\n...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "小但非常勇敢的老鼠 Brain 没有被录取进入年轻反派的暑期学校。他感到沮丧,决定推迟征服世界的计划,转而成为一名摄影师。\n\n正如你所知,最酷的照片是在胶片上的(因为你可以为这样的照片添加标签 #film)。\n\nBrain 在彩色和黑白胶片上拍摄了大量彩色照片。然后他将这些照片冲洗并转换为数字格式。但现在,彩色和黑白照片混在同一个文件夹中,要将它们分类需要花费一个多小时!\n\n由于 Brain 现在...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n, m \\in \\mathbb{Z} $ denote the dimensions of the pixel matrix, with $ 1 \\leq n, m \\leq 100 $.  \nLet $ P \\in \\{C, M, Y, W, G, B\\}^{n \\times m} $ be the matrix representing the...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments