Find the median(线段树离散化+区间更新)
题目链接:https://ac.nowcoder.com/acm/contest/887/E
链接:https://ac.nowcoder.com/acm/contest/887/E
来源:牛客网
空间限制:C/C++ 131072K,其他语言262144K
64bit IO Format: %lld
题目描述
At first, you're given an empty sequence. There are N operations. The i-th operation contains two integers LiL_iLi and RiR_iRi. This means that adding Ri−Li+1R_i-L_i+1Ri−Li+1 integers Li,Li+1,...,RiL_i, L_i+1, ... , R_iLi,Li+1,...,Ri into the sequence. After each operation, you need to find the median of the sequence.
输入描述:
The first line of the input contains an integer N (1≤N≤400000)N\ (1 \leq N \leq 400000)N (1≤N≤400000) as described above. The next two lines each contains six integers in the following format, respectively: - X1 X2 A1 B1 C1 M1X_1\ X_2\ A_1\ B_1\ C_1\ M_1X1 X2 A1 B1 C1 M1- Y1 Y2 A2 B2 C2 M2Y_1\ Y_2\ A_2\ B_2\ C_2\ M_2Y1 Y2 A2 B2 C2 M2 These values are used to generate Li,RiL_i, R_iLi,Ri as follows: We define:- Xi=(A1×Xi−1+B1×Xi−2+C1) module M1X_i = (A_1 \times X_{i-1} + B_1 \times X_{i-2} + C_1)\ module\ M_1Xi=
转载于:https://www.cnblogs.com/caijiaming/p/11348761.html
Find the median(线段树离散化+区间更新)相关推荐
- poj 2528 Mayor's posters(线段树 离散化 区间更新 贴海报)
这个题目本来对大神来说可能是水题, 对我就不行了,昨晚非折腾到下半夜一点 搞定, 并且可以总结出 ,只有把问题想清楚,或着看人家解题报告自己把问题和代码思路 搞清楚,才能谈的上调bug,否则 ...
- java-HDU1698(线段树的区间更新,和区间查询)
HDU1698: 题目意思: Just a Hook Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Ja ...
- (转)线段树的区间更新
原文地址:http://blog.csdn.net/zip_fan/article/details/46775633 写的很好,昨天刚刚开始写线段树,有些地方还不是很明白,看了这篇博文,学会了数组形式 ...
- 【HDU - 3974】 Assign the task (dfs序 + 线段树维护 区间更新+ 单点查询)
题干: There is a company that has N employees(numbered from 1 to N),every employee in the company has ...
- 【POJ - 3468 】 A Simple Problem with Integers (线段树模板 区间更新 + 区间和查询)(不能树状数组或差分数组)
题干: You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type o ...
- 【HDU - 5649】DZY Loves Sorting(线段树,区间更新区间查询,思维,01缩数变换,线段树分割)
题干: DZY has a sequence a[1..n]a[1..n]. It is a permutation of integers 1∼n1∼n. Now he wants to perfo ...
- POJ 3468 A Simple Problem with Integers(线段树:区间更新)
http://poj.org/problem?id=3468 题意: 给出一串数,每次在一个区间内增加c,查询[a,b]时输出a.b之间的总和. 思路: 总结一下懒惰标记的用法吧. 比如要对一个区间范 ...
- HDU 4267 线段树 离散点区间更新, 自叶子节点至根单点查询
题意: n个数字 下面n个数字表示数列 2个操作 1 [u, v] k add [u,v ]区间 (u点要计算)每隔k个位置,该数字+add 2 pos 询问 pos下标的值(下标从1开始) 思路 ...
- 【HDU - 1698】 Just a Hook(线段树模板 区间覆盖更新(laz标记) + 区间和查询 )
题干: In the game of DotA, Pudge's meat hook is actually the most horrible thing for most of the heroe ...
最新文章
- 【错误记录】p7zip 交叉编译 Android 版本 NDK 报错 ( error: case value evaluates to -2 , which cannot be narrowed )
- 链表学习(一)静态链表的构造
- oracle 找不到程序单元,Oracle Web ADI 加载时错误:ORA-06508: PL/SQL: 无法在调用之前找到程序单元...
- JVM逃逸分析(同步省略、标量替换、栈上分配)
- js源码 模仿 jquery的ajax的获取数据(get,post )的请求封装
- 为啥八位的计算机可以用补码表示-128
- ORACLE 中ROWNUM用法总结!
- BZOJ 3925: [Zjoi2015]地震后的幻想乡(概率)
- UVA-10817- Headmaster's Headache(状压DP)
- 理解 Redux 的最好方式,是自己写一个
- svm 文本分类 matlab,livsvm文本分类总结详解
- jquery隐式迭代
- c语言彩票号码生成器
- 计算机组成原理中断实验的分析,计算机组成原理_中断实验.pdf
- 首次!中国移动在Nature 杂志子刊 Nature Electronics发表5G高能效通信技术文章
- CTFSHOW 萌新赛 萌新记忆
- 2018初中计算机考试知识点,2018计算机等级考试考点:考前学习的技巧
- vivo Y85的usb调试模式在哪里,打开vivo Y85usb调试模式的方法
- Jenkins版本升级指南
- Code::Blocks之软件汉化
热门文章
- C#面向对象 基础概念二十五个 (很基础,必须掌握的知识)
- IIS7.X上传文件大小受限制解决方法
- 问题:使用pandas中的DataFrame写入csv文件多出一行unnamed,如何解决呢??
- post-commit hook failed (exit code 255) with no output 解决方案
- Python面试题解答——第二部分企业面试题
- gcc编译ceres-solver报错‘is_trivially_default_constructible’ is not a member of ‘std’
- 深度学习福利入门到精通第二讲——AlexNet模型
- python语言开发平台_Go+Python双语言混合开发
- 5h是什么意思_2B铅笔中的2B是啥意思?
- 排列组合在计算机科学的应用,数学在计算机科学的应用.doc