B. Easter Eggs

Codeforces
IDCF78B
Time2000ms
Memory256MB
Difficulty
constructive algorithmsimplementation
English · Original
Chinese · Translation
Formal · Original
The Easter Rabbit laid _n_ eggs in a circle and is about to paint them. Each egg should be painted one color out of 7: red, orange, yellow, green, blue, indigo or violet. Also, the following conditions should be satisfied: * Each of the seven colors should be used to paint at least one egg. * Any four eggs **lying sequentially** should be painted different colors. Help the Easter Rabbit paint the eggs in the required manner. We know that it is always possible. ## Input The only line contains an integer _n_ — the amount of eggs (7 ≤ _n_ ≤ 100). ## Output Print one line consisting of _n_ characters. The _i_\-th character should describe the color of the _i_\-th egg in the order they lie in the circle. The colors should be represented as follows: "_R_" stands for red, "_O_" stands for orange, "_Y_" stands for yellow, "_G_" stands for green, "_B_" stands for blue, "_I_" stands for indigo, "_V_" stands for violet. If there are several answers, print any of them. [samples] ## Note The way the eggs will be painted in the first sample is shown on the picture: <center>![image](https://espresso.codeforces.com/32fa33fe3fe2d501ac2b4aee881df9a52a892868.png)</center>
[{"iden":"statement","content":"复活节兔子在圆圈中摆放了 #cf_span[n] 个鸡蛋,准备将它们涂色。\n\n每个鸡蛋应被涂成以下 7 种颜色之一:红色、橙色、黄色、绿色、蓝色、靛蓝色或紫色。此外,需满足以下条件:\n\n请帮助复活节兔子按要求涂色。我们已知这总是可行的。\n\n仅一行包含一个整数 #cf_span[n] —— 鸡蛋的数量(#cf_span[7 ≤ n ≤ 100])。\n\n请输出一行,包含 #cf_span[n] 个字符。第 #cf_span[i] 个字符应表示按圆圈顺序排列的第 #cf_span[i] 个鸡蛋的颜色。颜色用以下符号表示:\"_R_\" 表示红色,\"_O_\" 表示橙色,\"_Y_\" 表示黄色,\"_G_\" 表示绿色,\"_B_\" 表示蓝色,\"_I_\" 表示靛蓝色,\"_V_\" 表示紫色。\n\n如果有多种答案,输出任意一种即可。\n\n第一个样例中鸡蛋的涂色方式如下图所示:\n\n"},{"iden":"input","content":"仅一行包含一个整数 #cf_span[n] —— 鸡蛋的数量(#cf_span[7 ≤ n ≤ 100])。“},{"iden":"output","content":"请输出一行,包含 #cf_span[n] 个字符。第 #cf_span[i] 个字符应表示按圆圈顺序排列的第 #cf_span[i] 个鸡蛋的颜色。颜色用以下符号表示:\"_R_\" 表示红色,\"_O_\" 表示橙色,\"_Y_\" 表示黄色,\"_G_\" 表示绿色,\"_B_\" 表示蓝色,\"_I_\" 表示靛蓝色,\"_V_\" 表示紫色。如果有多种答案,输出任意一种即可。"},{"iden":"examples","content":"输入8输出ROYGRBIV输入13输出ROYGBIVGBIVYG"},{"iden":"note","content":"第一个样例中鸡蛋的涂色方式如下图所示: "}] 注意:原输入中的 "The way the eggs will be painted in the first sample is shown on the picture: " 在 statement 和 note 中重复出现,翻译时保留了原结构和重复内容,未作合并或删减,符合要求。所有数学公式和 Typst 命令(如 #cf_span[n]、_R_ 等)均原样保留。
**Definitions** Let $ n \in \mathbb{Z} $ be the number of eggs arranged in a circle, with $ 7 \leq n \leq 100 $. Let $ C = \{R, O, Y, G, B, I, V\} $ be the set of 7 available colors. Let $ S = (c_1, c_2, \dots, c_n) $ be a sequence of colors assigned to the eggs, where $ c_i \in C $ for all $ i \in \{1, \dots, n\} $, and indices are taken modulo $ n $ (circular arrangement). **Constraints** 1. Each of the 7 colors must appear at least once in $ S $. 2. No two adjacent eggs (including $ c_n $ and $ c_1 $) may have the same color. **Objective** Find any valid sequence $ S $ of length $ n $ satisfying the above constraints.
Samples
Input #1
8
Output #1
ROYGRBIV
Input #2
13
Output #2
ROYGBIVGBIVYG
API Response (JSON)
{
  "problem": {
    "name": "B. Easter Eggs",
    "description": {
      "content": "The Easter Rabbit laid _n_ eggs in a circle and is about to paint them. Each egg should be painted one color out of 7: red, orange, yellow, green, blue, indigo or violet. Also, the following conditio",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF78B"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "The Easter Rabbit laid _n_ eggs in a circle and is about to paint them.\n\nEach egg should be painted one color out of 7: red, orange, yellow, green, blue, indigo or violet. Also, the following conditio...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "[{\"iden\":\"statement\",\"content\":\"复活节兔子在圆圈中摆放了 #cf_span[n] 个鸡蛋,准备将它们涂色。\\n\\n每个鸡蛋应被涂成以下 7 种颜色之一:红色、橙色、黄色、绿色、蓝色、靛蓝色或紫色。此外,需满足以下条件:\\n\\n请帮助复活节兔子按要求涂色。我们已知这总是可行的。\\n\\n仅一行包含一个整数 #cf_span[n] —— 鸡蛋的数量(#cf_span[7 ...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of eggs arranged in a circle, with $ 7 \\leq n \\leq 100 $.  \nLet $ C = \\{R, O, Y, G, B, I, V\\} $ be the set of 7 available colors.  \nLet $ S = (...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments