CF989A.A Blend of Springtime
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
When the curtains are opened, a canvas unfolds outside. Kanno marvels at all the blonde colours along the riverside — not tangerines, but blossoms instead.
"What a pity it's already late spring," sighs Mino with regret, "one more drizzling night and they'd be gone."
"But these blends are at their best, aren't they?" Absorbed in the landscape, Kanno remains optimistic.
The landscape can be expressed as a row of consecutive cells, each of which either contains a flower of colour amber or buff or canary yellow, or is empty.
When a flower withers, it disappears from the cell that it originally belonged to, and it spreads petals of its colour in its two neighbouring cells (or outside the field if the cell is on the side of the landscape). In case petals fall outside the given cells, they simply become invisible.
You are to help Kanno determine whether it's possible that after some (possibly none or all) flowers shed their petals, at least one of the cells contains all three colours, considering both petals and flowers. Note that flowers can wither in arbitrary order.
当窗帘拉开,窗外展开一幅画卷。神野惊叹于河岸沿线的金发色——不是橘子,而是盛开的花朵。
“真可惜,已是暮春时节了。”美浓带着遗憾叹息道,“再下一场淅淅沥沥的夜雨,它们就将凋零。”
“但此刻这几种色彩的交融,不正是最美好的状态吗?”神野沉醉于风景之中,依旧乐观。
该风景可建模为一排连续的格子,每个格子中要么盛开着一朵琥珀色(amber)、米黄色(buff)或黄褐色(canary yellow)的花,要么为空。
当一朵花凋谢时,它会从原本所在的格子中消失,并向其左右两个相邻格子(若该格子位于景观边缘,则可能扩散至场外)播撒与其自身颜色相同的花瓣。若花瓣飘落至给定格子范围之外,则直接不可见。
你需要帮助神野判断:在若干朵(可能为零朵、部分或全部)花依次凋谢并播撒花瓣后,是否至少存在一个格子,其中同时包含全部三种颜色(即琥珀色、米黄色与黄褐色)——此处“包含”既指该格子中原有的花朵,也指后来飘落至此的花瓣。注意:花朵可以以任意顺序凋谢。
输入格式
The first and only line of input contains a non-empty string s consisting of uppercase English letters 'A', 'B', 'C' and characters '.' (dots) only (∣s∣≤100) — denoting cells containing an amber flower, a buff one, a canary yellow one, and no flowers, respectively.
输入仅有一行,包含一个非空字符串 s,该字符串仅由大写英文字母 'A'、'B'、'C' 以及字符 '.'(句点)组成(∣s∣≤100),分别表示含有琥珀色花朵、米色花朵、金丝雀黄色花朵的格子,以及没有花朵的格子。
输出格式
Output "Yes" if it's possible that all three colours appear in some cell, and "No" otherwise.
You can print each letter in any case (upper or lower).
如果存在某个格子中三种颜色同时出现,则输出“Yes”;否则输出“No”。
您可以以任意大小写(大写或小写)输出每个字母。
输入输出样例
输入#1
.BAC.
输出#1
Yes
输入#2
AA..CB
输出#2
No
说明/提示
In the first example, the buff and canary yellow flowers can leave their petals in the central cell, blending all three colours in it.
In the second example, it's impossible to satisfy the requirement because there is no way that amber and buff meet in any cell.
在第一个例子中,浅粉色和金丝雀黄的花朵可以将它们的花瓣留在中心格子中,使三种颜色在该格子中混合。
在第二个例子中,无法满足要求,因为琥珀色和浅粉色无法在任何格子中相遇。
输入解题思路,AI测评打分。不知道怎么写?