<题目链接> 题目大意: 进行两种操作:1.给定一个数的出现时间.价值.消失时间: 2.进行一次询问,问你当前时间,第K大的数的价值. 解题分析: 采用离线集中处理,将每个数的出现时间和它的消失时间分组存下,并且存下所有的询问.然后就是依次进行所有询问,将这些询问时间点之前的点插入,将已经消失的点删除.因为算了一下复杂度感觉能过,所以就没有用离散化,线段树的代表区间大小就是1~1e6,线段树的节点维护的信息就是这个节点所对应区间的有效节点个数. #include <bits/stdc++…
Zhenya moves from parents 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/C Description Zhenya moved from his parents' home to study in other city. He didn't take any cash with him, he only took his father's credit card with zero balance o…
题意: 有两种操作:1.在[l,r]上插入一条值为val的线段 2.问p位置上值第k小的线段的值(是否存在) 特别的,询问的时候l和p合起来是一个递增序列 1<=l,r<=1e9:1<=val<=1e6; 1<=k<=1e9 思路: 因为l和p总体是递增的,第i个询问的p一定大于i之前所有操作的l,而前面能影响到i的答案的只有r>=p的线段.由此可以想到将l,r,p合起来离散化,从左往右扫描,遇到l,就在权值线段树上插入对应的val,遇到r就删除对应的val,而遇…
K - The Stream of Corning 2 这个题目不是很难,因为给你的这个S是单调递增的,所以就用优先队列+权值线段树就可以很快的解决了. 这个+读入挂可以优化,不过不用也没关系. #include <cstdio> #include <cstring> #include <cstdlib> #include <queue> #include <bitset> #include <string> #include <…
Flipping Parentheses 题目连接: http://codeforces.com/gym/100803/attachments Description A string consisting only of parentheses '(' and ')' is called balanced if it is one of the following. • A string "()" is balanced. • Concatenation of two balance…
Intervals 题目连接: http://codeforces.com/gym/100231/attachments Description 给你n个区间,告诉你每个区间内都有ci个数 然后你需要找一个最小的点集,使得满足这n个区间的条件 Input n 然后li,ri,ci Output 输出最小点集大小 Sample Input 5 3 7 3 8 10 3 6 8 1 1 3 1 10 11 1 Sample Output 6 Hint 题意 题解: 线段树+二分+贪心 首先我们贪心一…
F. Ilya Muromets Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/problem/F Description I Ilya Muromets is a legendary bogatyr. Right now he is struggling against Zmej Gorynych, a dragon with n heads numbered from 1 to nf…
D. Selection Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Description When selecting files in an application dialog, Vasya noted that he can get the same selection in different ways. A simple mouse click selects a sing…
题目链接: http://codeforces.com/gym/100526 http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11668&courseid=0 题目大意: N个人,每个人有三个能力排名X Y Z,每种能力没有同名次,如果当前的人比在清单上的人中至少有一项能力都要优,则这个人也会被加到清单上. 求最终清单上有几个人.(N<=100000) 题目思路: [线段树] 首先按第三关键字排序,确定一…
题目链接:http://codeforces.com/gym/101466/problem/K 题目: 题意: 给你一棵有n个节点的树,根节点始终为0,有两种操作: 1.RAND:查询以u为根节点的子树上的所有节点的权值的乘积x,及x的因数个数. 2.SEED:将节点u的权值乘以x. 思路: 比赛时少看了因数不大于13这句话,然后本题难度增加数倍,肝了两个小时都没肝出来,对不起队友啊,今天的组队训练赛实力背锅…… 这题一眼线段树,由于是对一棵子树进行处理,因此我们采用常规套路,借助dfs序将子树…