题目链接:http://poj.org/problem?id=3253思路:题目与哈夫曼编码原理相同,使用优先队列与贪心思想;读入数据在优先队列中,弹出两个数计算它们的和,再压入队列中;代码:#include #include using namespace std;struct cmp{ b...
分类:
其他好文 时间:
2014-11-10 19:32:09
阅读次数:
161
Codeforces 484E Sign on Fence
题意:给n个高度为h的木板,连续放置。
然后询问l,r区间内,连续w个最小高度的最大值是多少。
做法:首先询问可以用二分答案,然后对于每个二分的值
我们需要建主席树来验证是否可行。
主席树主要实现功能,显然,如果把高度大于等于二分值ans
位置都置为1,其他位置置为0,那么我们只需要验证区间
l,r中是否有超过w个连...
分类:
其他好文 时间:
2014-11-10 15:36:48
阅读次数:
181
嵌入式linux应用程序调试方法四 内存工具 174.1 MEMWATCH 174.2 YAMD 224.3 Electric Fence 24五 C/C++代码覆盖、性能profiling工具 245.1 用gcov来测试代码覆盖率 255.2 使用gprof来...
分类:
系统相关 时间:
2014-11-10 01:05:52
阅读次数:
595
Color the fence
时间限制:1000 ms | 内存限制:65535 KB
难度:2
描述
Tom has fallen in love with Mary. Now Tom wants to show his love and write a number on the fence opposite to
Mary’s house. Tom thinks t...
分类:
其他好文 时间:
2014-11-07 01:04:06
阅读次数:
286
题目链接:Codeforces 484E Sign on Fence
题目大意:给定给一个序列,每个位置有一个值,表示高度,现在有若干查询,每次查询l,r,w,表示在区间l,r中,
连续最长长度大于w的最大高度为多少。
解题思路:可持久化线段树维护区间合并,前端时间碰到一题可持久化字典树,就去查了一下相关论文,大概知道了是
什么东西。
将高度按照从大到小的顺序排序...
分类:
其他好文 时间:
2014-11-07 01:00:01
阅读次数:
343
Fence Repair
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 27140
Accepted: 8829
Description
Farmer John wants to repair a small length of the fence aro...
分类:
其他好文 时间:
2014-10-30 15:20:02
阅读次数:
168
Fence Repair
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 27055
Accepted: 8800
Description
Farmer John wants to repair a small length of the fence aroun...
分类:
其他好文 时间:
2014-10-23 17:39:22
阅读次数:
147
Fence Repair
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 27043
Accepted: 8792
Description
Farmer John wants to repair a small length of the fence aroun...
分类:
其他好文 时间:
2014-10-21 21:44:56
阅读次数:
278
题意:求给定图的欧拉回路(每条边只走一次)若欧拉回路存在,图中只可能有0个or2个奇数度的点。求解时,若有奇数度的点,则必须从该点开始。否则可以从任一点开始求解过程:dfs 1 //主程序部分 2 # circuit is a global array 3 find_euler_circuit...
分类:
其他好文 时间:
2014-10-19 21:08:02
阅读次数:
117
将一块很长的木板切割成N块,长度分别为L1、L2、…、LN。每次切割需要的开销为当前木板的长度。求出将木板切割完最小开销是多少。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 #define MAX_N 30000 7...
分类:
其他好文 时间:
2014-10-08 12:53:55
阅读次数:
174