数据结构
文章平均质量分 78
buaa_kiss
这个作者很懒,什么都没留下…
展开
-
第一篇..poj3468 线段树解法
之前这道题用树状数组水过的,但是用线段树一直wa或者tle,昨天终于AC了。。贴一下,binsec结构可当模版.#include #include #include #include using namespace std;const int M=131072;原创 2011-07-31 22:10:31 · 263 阅读 · 0 评论 -
离散化模版
templatestruct line{ T a,b;};templatestruct helper{ T v;//原值 int index;//原值的位置 static int cmp(const void*a,const void*b) { T r=原创 2011-07-31 22:25:33 · 324 阅读 · 0 评论 -
【POJ 1656】 水题,不过抄了个二维线段树的代码
#include #include #include int num[2000001], cover[2000001];void push(int idx, int lx, int rx, int ly, int ry){ if (cover[idx] == -1)原创 2011-08-01 16:22:39 · 464 阅读 · 0 评论 -
【HDU 3909】变种Sudoku 拿个漂亮的当模板吧——dancingLinkx
对于N=2,3,4分别对于4*4,9*9,16*16的4进制、9进制、16进制#include #include #include #include #include #include #include #include #include #define转载 2011-08-03 13:12:02 · 340 阅读 · 0 评论 -
[HDU 4069]刷的水DLX
终于过了。。。要记住 记解,解可能被覆盖memO的故事。。。题意:求 一行+一列+不规则图形 满足数独的解原题:Squiggly SudokuTime Limit: 4000/2000 MS (Java/Others) Memory Limit:原创 2011-10-11 22:49:08 · 466 阅读 · 0 评论 -
【POJ 1084】 很烦人的DLX
DLX。。。一开始读错题目了。。。是要把所有正方形都消掉!!!代码里面有两种统计正方形和火柴的方法,都值得借鉴。。Orz发一下代码 #include#include#include#includeusing name原创 2011-10-14 20:02:31 · 1280 阅读 · 0 评论 -
貌似是对的。哈夫曼树的路径长度——堆优化
/*【问题描述】已知输入一串正整数,正整数之间用空格键分开,请建立一个哈夫曼树,以输入的数字为叶节点,求这棵哈夫曼树的带权路径长度。【输入形式】首先输入正整数的个数,然后接下来为接下来的正整数,正整数个数不超过10个【输出形式】输出相应的权值【样例输入】5 4 5 6 7 8【样例输出】69*/#include #include typedef struct Node{原创 2011-11-15 19:32:46 · 1766 阅读 · 1 评论 -
未经验证的堆 C 代码,求验证
rt#include #include int len;int heap[20];void swap(int *a,int *b){ int tmp=*a; *a=*b; *b=tmp;}void push_heap(int *heap,int s){ heap[++len]=s; int t=len;原创 2011-11-15 19:15:08 · 272 阅读 · 0 评论