当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
Jonly is writing his first computer game. For the opening scene he wants to have the main character, Wormly, cross Bridgely, the bridge. Wormly is a worm made of b equal circular bubbles and L legs. At all times each leg has to be under one of the bubbles, and under each bubble there can be at most one leg. Bridgely was supposed to be composed of n planks with the width of each plank equal to the diameter of each of Wormly's bubbles. However, some of the planks are missing.
At every moment, Wormly can do exactly one of the following:

Wormly 想要过桥。这个桥由本来由n块板子组成,但有的板子不见了。
每个时刻里,wormly可以做这些事:
1、 向前移动一个脚到一块板子,要求不能越过前面的腿(图中c),不能落在消失的板子上(图中a);
2、 把所有的球向前移动一格,腿不动。移完之后,每条腿必须还在某个球下。
一开始虫在最左的b块板子上,腿在最左的L块板子上,最后虫在最右的b块板子上,腿在最右的L块板子上。这个过程最少要多少时间?
On the first line a positive integer: the number of test cases, at most 100. After that per test case:
T 测试数据组数<=100
L, b and n (1 ≤ L ≤ b ≤ n ≤ 1 000 000)
N位01串,1代表有板子
Per test case:
Now Jonly is wondering how long the animation takes until Wormly reaches the end of Bridgely. Initially Wormly's bubbles are directly above the leftmost b planks of the bridge and its legs are on the leftmost L planks. At the end of the animation Wormly's bubbles have to be directly above the rightmost b planks and its legs have to be on the rightmost L planks.
The left- and rightmost L planks of Bridgely are not missing.
IMPOSSIBLE或者是最小的通过时间.
3 1 2 2 11 2 3 5 11011 1 3 5 11011
1 IMPOSSIBLE 5
第3个样例:移动腿-移动球-移动腿-移动球-移动腿 5步
鸣谢SJTU YYD
| bzoj_id | 2268 |
| import_source_sha256 | dd340c0b3cff28a472076c20950dab2744270162f546d53f6cf5f68a9add0d01 |
| bzoj_checker_pending | False |
| 时间上限 | 内存上限 |
| 1000 MS | 128 MB |