A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with...
分类:
其他好文 时间:
2015-04-05 14:40:31
阅读次数:
171
DZY Loves Topological SortingTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 866Accepted Submis...
分类:
编程语言 时间:
2015-04-05 14:32:48
阅读次数:
174
Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,?x2,?…,?xk (k?>?1) is such maximum element xj, that the following in...
分类:
其他好文 时间:
2015-04-03 15:21:56
阅读次数:
154
要求在一个DAG中删去不多于k条边,使得拓扑序的字典序最大。
贪心策略:每次删去入度小于res的,序号尽量大的点的入边。
需要用线段树维护区间最小值。
代码:
#include
#include
#include
#include
#include
#include
#include
using namespace std;
const int N = 400000 +10;
const ...
分类:
编程语言 时间:
2015-04-03 09:32:36
阅读次数:
157
The little girl loves the problems on array queries very much.One day she came across a rather well-known problem: you’ve got an array of n elements (the elements of the array are indexed starting from...
分类:
其他好文 时间:
2015-04-02 16:31:33
阅读次数:
125
Urej loves to play various types of dull games. He usually asks other people to play with him. He says that playing those games can show his extraordinary wit. Recently Urej takes a great interest in a new game, and Erif Nezorf becomes the victim. To get a...
分类:
其他好文 时间:
2015-04-02 09:08:58
阅读次数:
269
每次找出入度小于K的编号最大点。
找的时候用线段树找,找完之后将这个点出度链接的点的入度全部减一
简直爆炸。。。
#include
#include
#include
#include
using namespace std;
#define lson (pos<<1)
#define rson (pos<<1|1)
const int maxn = 100005;
const int IN...
分类:
其他好文 时间:
2015-04-01 21:53:16
阅读次数:
104
题意查询给定[L, R]区间内 逆序对数 ==k的子区间的个数。我们只需要求出 子区间小于等于k的个数和小于等于k-1的个数,然后相减就得出答案了。对于i(1≤i≤n),我们计算ri表示[i,ri]的逆序对数小于等于K,且ri的值最大。(ri对应代码中的cnt数组)显然ri单调不降,我们可以通过用两...
分类:
编程语言 时间:
2015-04-01 19:20:28
阅读次数:
234
Description
One day, Alice and Bob felt bored again, Bob knows Alice is a girl who loves math and is just learning something about matrix, so he decided to make a crazy problem for her.
Bob has...
分类:
其他好文 时间:
2015-03-31 12:52:29
阅读次数:
129
DZY Loves Balls
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 394 Accepted Submission(s): 221
Problem Description
There are n ...
分类:
其他好文 时间:
2015-03-30 23:10:34
阅读次数:
378