QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 512 MB Points totaux : 100 Hackable ✓

#6808. 百合

Statistiques
  • 它们的作用是将氢气转化为可呼吸的氧气,就像地球上的空气一样,在这里也是必不可少的。
  • 但我还是要说,它们是花。
  • 如果你喜欢的话。
  • 你卖吗?
  • 恐怕不行。
  • 但是,也许我们可以做个交易。
  • 你是什么意思?
  • 哦,你看,你不需要把它们送到任何地方。我会付钱买下它们。但之后,我会把它们留在这里,留给你。 — 《Assignment Outerspace》, 1960

万物皆有始有终。我的旅程即将结束,我已经准备好告别我的昨天。但你,我亲爱的朋友,你的旅程在 2022 CCPC 桂林站依然充满活力。我们衷心希望你在这里找到一个新的里程碑,带着你的爱与激情在未来奋勇前行。

百合花是一种美丽的花。它通常一年只开一次,所以如果你能看到百合花盛开,那将是非常珍贵的。然而,它对猫有剧毒,所以你必须注意让好奇的猫远离可爱的百合花。

你有一排 $n$ 个土壤网格,编号从 $1$ 到 $n$,其中一些种有百合花。我们既不想伤害百合花,也不想伤害猫。你可以在网格上放置一些猫粮,但对于任何放置了猫粮的网格 $i$,其索引在 $[i - 1, i + 1]$ 范围内的网格都不能包含百合花。你既爱猫也爱百合花,所以你想最大化放置猫粮的网格数量。

请设计一个方案来满足上述要求。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 1000$),表示网格的数量。

第二行包含一个仅由 ‘L’ 和 ‘.’ 组成的字符串 $R$,表示有百合花和没有百合花的网格。

输出格式

输出包含一行,为一个仅由 ‘L’、‘.’ 和 ‘C’ 组成的字符串 $R'$,其中 ‘C’ 表示你在 $R$ 的空网格中分配的猫粮,同时满足上述要求。

如果存在多种方案,输出任意一种即可。

样例

样例输入 1

5
..L..

样例输出 1

C.L.C

样例输入 2

2
..

样例输出 2

CC

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.