hzau 1207 Candies
1207: Candies
Time Limit: 2 Sec Memory Limit: 1280 MB
Submit: 223 Solved: 31
[Submit][Status][Web Board]
Description
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.
Input
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.
Output
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.
Sample Input
1
5 3
ABABB
2 1 3
1 2 3 2
2 1 3
Sample Output
Case #1:
1
2
HINT
hzau 1207 Candies的更多相关文章
- HZAU 1207 Candies(线段树区间查询 区间修改)
[题目链接]http://acm.hzau.edu.cn/problem.php?id=1207 [题意]给你一个字符串,然后两种操作:1,将区间L,R更新为A或者B,2,询问区间L,R最长的连续的B ...
- 【POJ2886】Who Gets the Most Candies?-线段树+反素数
Time Limit: 5000MS Memory Limit: 131072K Case Time Limit: 2000MS Description N children are sitting ...
- poj 3159 Candies 差分约束
Candies Time Limit: 1500MS Memory Limit: 131072K Total Submissions: 22177 Accepted: 5936 Descrip ...
- Who Gets the Most Candies?(线段树 + 反素数 )
Who Gets the Most Candies? Time Limit:5000MS Memory Limit:131072KB 64bit IO Format:%I64d &am ...
- poj---(2886)Who Gets the Most Candies?(线段树+数论)
Who Gets the Most Candies? Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 10373 Acc ...
- poj3159 Candies(差分约束,dij+heap)
poj3159 Candies 这题实质为裸的差分约束. 先看最短路模型:若d[v] >= d[u] + w, 则连边u->v,之后就变成了d[v] <= d[u] + w , 即d ...
- HDU 5127 Dogs' Candies
Dogs' Candies Time Limit: 30000/30000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others) T ...
- C. Om Nom and Candies 巧妙优化枚举,将复杂度控制在10e6
C. Om Nom and Candies 无线超大背包问题 #include <iostream> #include <cstdio> #include <cstrin ...
- POJ 3159 Candies (栈优化spfa)
Candies 题目链接: http://acm.hust.edu.cn/vjudge/contest/122685#problem/J Description During the kinderga ...
随机推荐
- Vue中使用定时器setInterval和setTimeout
js中定时器有两种,一个是循环执行setInterval,另一个是定时执行setTimeout 一.循环执行(setInterval) 顾名思义,循环执行就是设置一个时间间隔,每过一段时间都会执行一次 ...
- (4.12)全面解析-SQL事务+隔离级别+阻塞+死锁
30分钟全面解析-SQL事务+隔离级别+阻塞+死锁 转自:https://blog.csdn.net/slowlifes/article/details/52752735 2016年10月07日 23 ...
- MySQL中的DDL,DML
MySQL中的DDL,DMLDDL:数据定义语言: CREATE,ALTER,DROP DB组件:数据库.表.索引.视图.用户.存储过程.存储函数.触发器.事件调度器等 CR ...
- 标准c内存函数的使用方法
标准c内存函数 calloc 语法: #include <stdlib.h> void *calloc( size_t num, size_t size ); 功能: 函数返回 ...
- 做测试时,启动SpringBoot出现警告,在ClassPath中一个类多次出现
Found multiple occurrences of org.json.JSONObject on the class path: jar:file:/C:/Users/niaomingjian ...
- 面向对象高级编程——使用@property
在绑定属性的时候,如过我们直接把属性暴露出去,虽然写起来简单,但是,没办法检查参数,导致可以把成绩随意改: s = Student() s.score = 9999 #不符合常规依然可以更改 这显然不 ...
- 使用ajax进行汽车详情表的查询
主界面代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...
- UI控件之UITextField
UITextField:文本框:用来输入一行文本,父类是UIControl UITextField *field1=[[UITextField alloc]initWithFrame:CGRectMa ...
- 方法——<37>
1,返回url参数 /* * 返回参数值 * @method getUrlPara * @papram {string},url中参数名 * @return {string},url中参数值 * */ ...
- imx6qsbd kpp
转: https://blog.csdn.net/zyaiwmy/article/details/54313025 https://www.aliyun.com/jiaocheng/123973.ht ...