D. Developing Game   Pavel is going to make a game of his dream. However, he knows that he can't make it on his own so he founded a development company and hired n workers of staff. Now he wants to pick n workers from the staff who will be directly r…
D - Developing Game 思路:我们先枚举左边界,把合法的都扣出来,那么对于这些合法的来说值有v 和 r两维了,把v, r看成线段的两端, 问题就变成了,最多能选多少线段 使得不存在这样两条(l1 r1)  (l2 r2) l2 > r1,我们把线段l1 r1 看成二维平面内的点(l1, r1) 那么答案就变成了分别在(1, 1),  (2, 2),  (3, 3),  (4, 4), ....., (n, n)的左上的点的个数的最大值,我们用这个建 线段树然后就变成了区间加减问题…
链接: https://codeforces.com/contest/1263/problem/E 题意: The development of a text editor is a hard problem. You need to implement an extra module for brackets coloring in text. Your editor consists of a line with infinite length and cursor, which point…
B. Prison Transfer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/427/B Description The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c…
F. Cookies 链接:http://codeforces.com/contest/1099/problem/F 题意: 给你一棵树,树上有n个节点,每个节点上有ai块饼干,在这个节点上的每块饼干需要花费bi时间,有两个玩家,玩家一可以移动到当前点的子节点也可以申请游戏结束返回根节点并吃沿途的饼干,玩家二可以删除当前点到儿子节点的一条边,走路和吃饼干都消耗时间,会给出一个总时间,在总时间内尽可能的多吃饼干,问最多能吃多少个? 思路: 由于是玩家一先手,那么最开始的最大边则不会被删除,但之后路…
D. Developing Game 题目连接: http://www.codeforces.com/contest/377/problem/D Description Pavel is going to make a game of his dream. However, he knows that he can't make it on his own so he founded a development company and hired n workers of staff. Now…
https://codeforces.com/contest/1136/problem/E 题意 给你一个有n个数字的a数组,一个有n-1个数字的k数组,两种操作: 1.将a[i]+x,假如a[i]+k[i]>a[i+1],则a[i+1]要变成a[i]+k[i],直到某个a[j]+k[j]<=a[j+1] 2.询问某个区间的和 题解 利用题目性质将题目转化到你会的东西的性质 令\(t_i=k_1+..+k_{i-1},b_i=a_i-t_i\) \(a_i \geq a_{i-1} + k_{…
题意: 构造一个序列,满足m个形如:[l,r,c] 的条件. [l,r,c]表示[l,r]中的元素按位与(&)的和为c. 解法: 线段树维护,sum[rt]表示要满足到现在为止的条件时该子树的按位与和至少为多少. 更新时,如果val的pos位为1,那么整个区间的按位与和pos位也应该为1,否则与出来就不对了.(这是本题解题的核心) 那么此时更新 sum[rt] |= val 即可.然后再check一遍看是否满足所有条件即可. 代码: #include <iostream> #inclu…
F. Ant colony time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si…
D. Legacy time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Rick and his co-workers have made a new radioactive formula and a lot of bad guys are after them. So Rick wants to give his legacy…