#HK5007. 「POI2013 R1」消除游戏 Take-out
「POI2013 R1」消除游戏 Take-out
题目描述
题目译自 XX Olimpiada Informatyczna — I etap Usuwanka
小 Bajtosia 收到了一款名为「消除游戏」的礼物。游戏中有一串 个紧邻的积木,编号从 到 ,每块积木为白色或黑色,白色积木数量是黑色积木的 倍。这款单人游戏的目标是通过特定操作,移除所有积木。
每次操作需移除恰好 个白色积木和 个黑色积木,且不改变其余积木位置。操作需满足条件:移除的积木之间无空隙,即无先前移除积木留下的空白。
Bajtosia 恳求你的帮助!请为她找出一组合法操作序列,移除所有积木。
输入格式
第一行包含两个整数 ,分别表示积木总数和每次操作需移除的白色积木数。保证 。
第二行包含一个长度为 的字符串,由字母 b(白色)和 c(黑色)组成,依次表示各积木的颜色。
所有测试数据保证存在移除所有积木的操作序列。
输出格式
输出 行,每行描述一次操作,包含 个按升序排列的整数(用单个空格分隔),表示该操作移除的积木编号。
12 2
ccbcbbbbbbcb
1 8 12
2 6 7
3 4 5
9 10 11
让 代表被移除的块所留下的空白空间。通过执行上述移动,我们获得以下块排列:
$$\begin{array}{cccccccccccc} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\ \hline \texttt{c} & \texttt{c} & \texttt{b} & \texttt{c} & \texttt{b} & \texttt{b} & \texttt{b} & \texttt{b} & \texttt{b} & \texttt{b} & \texttt{c} & \texttt{b} \\ \sqcup & \texttt{c} & \texttt{b} & \texttt{c} & \texttt{b} & \texttt{b} & \texttt{b} & \sqcup & \texttt{b} & \texttt{b} & \texttt{c} & \sqcup \\ \sqcup & \sqcup & \texttt{b} & \texttt{c} & \texttt{b} & \sqcup & \sqcup & \sqcup & \texttt{b} & \texttt{b} & \texttt{c} & \sqcup \\ \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \texttt{b} & \texttt{b} & \texttt{c} & \sqcup \\ \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup & \sqcup \end{array} $$数据范围与提示
对于 的数据,。