2017ccpc 杭州Master of Sequence

Problem K. Master of Sequence
Therearetwosequencesa1,a2,··· ,an, b1,b2,··· ,bn. LetS(t) =∑n i=1⌊t−bi ai ⌋. Therearemoperationswithin three kinds as following: • 1 x y: change value ax to y. • 2 x y: change value bx to y. • 3 k: ask min{t|k ≤ S(t)} Input The first line contains a integer T (1 ≤ T ≤ 5) representing the number of test cases. For each test case, the first line contains two integers n (1 ≤ n ≤ 100000), m (1 ≤ m ≤ 10000). The following line contains n integers representing the sequence a1,a2,··· ,an. The following line contains n integers representing the sequence b1,b2,··· ,bn. The following m lines, each line contains two or three integers representing an operation mentioned above. It is guaranteed that, at any time, we have 1 ≤ ai ≤ 1000, 1 ≤ bi,k ≤ 109. And the number of queries (type 3 operation) in each test case will not exceed 1000.
Output For each query operation (type 3 operation), print the answer in one line.

分析:

b的范围只有1000,于是树状数组维护mod意义下的个数就好了;

 

转载于:https://www.cnblogs.com/dyzll/p/8850438.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值