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意义下的个数就好了;

2017ccpc 杭州Master of Sequence的更多相关文章

  1. Master of Sequence

    Master of Sequence 时间限制: 10 Sec  内存限制: 128 MB 题目描述 There are two sequences a1,a2,...,an , b1,b2,..., ...

  2. 2017CCPC 杭州 J. Master of GCD【差分标记/线段树/GCD】

    给你一个n个初始元素都为1的序列和m个询问q. 询问格式为:l r x(x为2or3) 最后求1~n所有数的GCD GCD:把每个数分别分解质因数,再把各数中的全部公有质因数提取出来连乘,所得的积就是 ...

  3. 2017CCPC杭州(ABCDJ)

    所有的题目在这里<--- 待补... Problem A. HDU6264:Super-palindrome 题意: 题目定义了一个超级回文串,这个串满足:它的任一奇数长度的串都是回文串. 现在 ...

  4. HDU 6274 Master of Sequence (暴力+下整除)

    题意 两个1e5的数组a,b,定义\(S(t)=\left \lfloor \frac{t-b_i}{a_i} \right \rfloor\),有三个操作 1 x y:将\(a[x]\)变为\(y\ ...

  5. 2017 CCPC杭州 题解

    2017CCPC杭州题目PDF Problem A. Super-palindrome 题解: 给你一个字符串,每一步可以将一个字符替换为另一个字符,问你最少多少步可以使得,该字符串任意奇数子串为回文 ...

  6. Oracle 11.2.0.4.0 Dataguard部署和日常维护(5)-Datauard 主备切换和故障转移篇

    1. dataguard主备切换   1.1. 查看当前主备库是否具备切换条件 on slave select sequence#,first_time,next_time,archived,appl ...

  7. python---基础知识回顾(九)图形用户界面-------Tkinter

    前戏:老牌python GUI程序(Tkinter) import tkinter.messagebox as messagebox class Application(Frame): def __i ...

  8. The 2017 China Collegiate Programming Contest, Hangzhou Site Solution

    A: Super_palindrome 题面:给出一个字符串,求改变最少的字符个数使得这个串所有长度为奇数的子串都是回文串 思路:显然,这个字符串肯定要改成所有奇数位相同并且所有偶数位相同 那统计一下 ...

  9. spark HMM

    Scala实现的: https://github.com/skrusche63/spark-intent/tree/master/src/main/scala/de/kp/scala/hmm http ...

随机推荐

  1. [USACO 2012 Jan Silver] Delivery Route【拆点】

    传送门:http://www.usaco.org/index.php?page=viewproblem2&cpid=106 这道题还真是完全没思路,真的不知道怎么做,但是看了题解后恍然大悟. ...

  2. 题解报告:hdu 1229 还是A+B

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1229 Problem Description 读入两个小于10000的正整数A和B,计算A+B.需要注 ...

  3. 题解报告:hdu 2709 Sumsets

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2709 Problem Description Farmer John commanded his co ...

  4. Mac OS X:在标题栏上显示目录完整路径

    众所周知mac的finder是不带路径显示的,你进入某个文件夹只会显示当前文件夹的名字而已.虽然你可以在finder的菜单栏中点“显示”-“显示路径栏”把路径栏调出来,但是这样只会不必要的增加find ...

  5. 转 PHP编程过程中需要了解的this,self,parent的区别

    {一}PHP中this,self,parent的区别之一this篇 面向对象编程(OOP,Object Oriented Programming)现已经成为编程人员的一项基本技能.利用OOP的思想进行 ...

  6. 222 Count Complete Tree Nodes 完全二叉树的节点个数

    给出一个完全二叉树,求出该树的节点个数.完全二叉树的定义如下:在完全二叉树中,除了最底层节点可能没填满外,其余每层节点数都达到最大值,并且最下面一层的节点都集中在该层最左边的若干位置.若最底层为第 h ...

  7. JAVA 高级特性 JDBC

     需要的jdbc jar 包: mysql-connector-java-5.1.38-b...960.9 KB ojdbc6.jar2.0 MB sqljdbc4.jar455.4 KB   数据持 ...

  8. poj2718 Smallest Difference

    思路: 暴力乱搞. 实现: #include <iostream> #include <cstdio> #include <sstream> #include &l ...

  9. mysql 修改 root 密码

    5.76中加了一些passwd的策略 MySQL's validate_password plugin is installed by default. This will require that ...

  10. 掌握Spark机器学习库-09.6-LDA算法

    数据集 iris.data 数据集概览 代码 package org.apache.spark.examples.examplesforml import org.apache.spark.ml.cl ...