1532: JuQueen
Time Limit: 5 Sec Memory Limit: 512 MB Submit: 363 Solved: 110 [ ][ ][ ] Description
Input
Output
Sample Input
10 10 5state 0groupchange 2 9 7state 9groupchange 0 2 10change 0 -5
Sample Output
0773-3
HINT
题意: 输入 :c n q ->给你初始[0,c)去为0的区间,q个操作,n是区间数的上限,即不能超过n
q次操作: state id 输出下标为id 的数
groupchange l r val 区间【l,r】上的每一个数:val>0。加1 val次,假设有一个数==n,停止操作。
val<0,减1 val次。假设有一个数==0,停止操作;输出实际加或减的次数。
change l val 同上,改为单点操作
题解:线段树维护区间最大值计最小值。
#include #include #include #include #include #include #include #include #include #include #include #include