发现一个小小的 逆序数里真的藏了好多东西啊=-=解决这题 你需要知道一点...对于一串给定的数字 我随便写一串吧..index: 0 1 2 3 4value: 4 8 7 5 6 这时候 总的逆序对数是 3+2=5 假如我们只能进行相邻元素的交换 这最好情况是什么呢?那肯定就是...
分类:
其他好文 时间:
2014-08-26 17:12:06
阅读次数:
170
Matrix
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 18460
Accepted: 6950
Description
Given an N*N matrix A, whose elements are either 0 or 1. A[i, j]...
分类:
其他好文 时间:
2014-08-26 11:42:15
阅读次数:
226
一开始想,总感觉是DP,可是最后什么都没想到。还暴力的交了一发。
然后开始写线段树,结果超时。感觉自己线段树的写法有问题。改天再写。先把树状数组的写法贴出来吧。
~~~~~~~~~~~~~~~~~~~~~~~~
树状数组不懂的去看刘汝佳的大白书,那个图画得很清楚。
题目大意:星星的坐标以y递增的顺序给出,这些点的左下方的点数代表这个点的级数,问0~N-1的级数有多少个?其实y根本木有用。
...
分类:
其他好文 时间:
2014-08-26 00:29:55
阅读次数:
174
Problem Description
There are n types of cells in the lab, numbered from 1 to n. These cells are put in a queue, the i-th cell belongs to type i. Each time I can use mitogen to double the cells in ...
分类:
其他好文 时间:
2014-08-25 01:13:03
阅读次数:
321
Description
Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= ...
分类:
其他好文 时间:
2014-08-24 23:54:53
阅读次数:
263
题目链接:uva 1428 - Ping pong
题目大意:一条大街上住着n个乒乓球爱好者,经常组织比赛。每个人都有一个不同的能力值,每场比赛需要3个人,裁判要住在两个选手之间,并且能力值也要在选手之间,问说最多能举行多少场比赛。
解题思路:预处理出bi和ci分别表示说在1~i中能力值比第i个人小的人和i+1~n中能力值比第i个人小的。处理过程用树状数组维护即可。
#include...
分类:
其他好文 时间:
2014-08-24 23:54:43
阅读次数:
287
UVA 10909 - Lucky Number
题目链接
题意:问一个数字能否由两个lucky num构造出来,lucky num根据题目中的定义
思路:利用树状数组找前k大的方法可以构造出lucky num的序列,然后每次查找n,就从n / 2开始往下查找即可
代码:
#include
#include
#include
using namespace st...
分类:
其他好文 时间:
2014-08-24 23:52:53
阅读次数:
423
Holedox EatingTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3362Accepted Submission(s): 1145Prob...
分类:
其他好文 时间:
2014-08-24 12:54:22
阅读次数:
246
Problem Description
N(3
Each player has a unique skill rank. To improve their skill rank, they often compete with each other. If two players want to compete, they must choose a referee among oth...
分类:
其他好文 时间:
2014-08-23 15:27:21
阅读次数:
253