Problem 1866 --Candies

1866: Candies

"
Time Limit $2$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $6$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签

     Xiao Ming likes those N candies he collects very much. There are two kinds of candies, A and B. One day, Xiao Ming puts his candies in a row and plays games. And he can replace the Lth candy to the Rth candy with the same kind of candies. Now, he wonder that if he eats the Lth candy to Rth candy, he can eat how many B candy continuously at most. For each Xiao Ming’s query, give the number of the B candy he can eat continuously at most. 

     In the first line, there is an integer T, indicates the number of test cases.

     For each case, there are two integers N and M in the first line, indicate the number of candies and the time of Xiao Ming’s operations.

     The second line is a N-length string consist of character A and B, indicates the row of candies Xiao Ming put.

     The next M line is Xiao Ming’s operations. There are two kind of operations:

          1. 1 L R v, indicate Xiao Ming replaces the Lth candy to the Rth candy with A candies (v==1) or B candies ( v == 2 ).

          2. 2 L R, indicate Xiao Ming wonder that there are how many continuous B candies between the Lth candy to the Rth candy most. 

       In each case, the first line is “Case #k: “, k indicates the case number.

      For each query, output the number of the most continuous B candies. 

1
5 3
ABABB
2 1 3
1 2 3 2
2 1 3
Case #1:
1
2

推荐代码 查看1866 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战 AOJ大管家 84160 2017-04-26 12:51:59

赛题来源/所属竞赛 NA N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛