Data Structure
文章平均质量分 79
kybconnor
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Uva 10954 - Add All
2Y 一开始贪心就1WA 优先队列 每次加最小的2个 然后插进去 #include #include struct num{ int x; bool operator < (const num &a) const { return x>a.x;//最小值优先 } }; std::priority_queueL; int main(){ int n原创 2013-04-13 22:35:45 · 701 阅读 · 0 评论 -
4道 Uva 并查集
上周做的=.= 没发上来.导致文件夹内大量cpp... 今天在学活从6点切到了9:30 uva313AC排名1396 呵呵=.= 明天下午校赛,上午就不做题了,把实验选了,开心就好 以上 并查集 以及通过并查集实现的最小生成树 459 - Graph Connectivity #include int ft[30]; void in_ft(int n){ int i;原创 2013-04-13 22:42:01 · 761 阅读 · 0 评论 -
Poj 2528 Mayor's posters
1MLE 2AC 3AC 学习了下线段树 还可以理解 第一次直接建树超内存 学习了下离散化,实际上就是把没出现过的点无视掉 第二次969ms飘过没有二分优化... 第三次63ms二分优化 好快=,= #include #include #include using namespace std; struct line{ int l,r; int x; }L[1<<16];原创 2013-05-01 18:20:30 · 534 阅读 · 0 评论 -
Poj 3468 A Simple Problem with Integers
需要lazy思想的线段树 原本都关机睡觉了,来了灵感,双重维护 听说过lazy的想法,实现方式是自己想到的,增量+子区间总和 5Y 3*TLE 1*WA 这个可以当做自己的模板了吧~~ TLE的关键点在于 insert和sum的结束条件都不能是T[w].l==T[w].r这样比O(n)的朴素算法还慢..貌似 想要加快sum,需要维护下段总和 想要加快insert,需要维护区间上原创 2013-05-02 00:30:35 · 568 阅读 · 0 评论 -
Poj 2352 Stars
nY 学习了下树状数组 手写的 大题能够理解 不过确实nb,,, ~~注意树状数组从1开始 0~32000是个trick 要++,注意改N的范围32001 #include int LB(int x){return x&(-x);} #define N 32001 int tree[32010]; void add(int w,int d){ for(;w<=N;w+=LB(w原创 2013-05-01 22:47:22 · 514 阅读 · 0 评论 -
Poj 1308 Is It A tree
1WA于句末标点,ipad手打伤口不起 2Y 并查集 手写离散化 学会了vector的erase+unique的用法 #include #include #include #define N 10000+10 using namespace std; int ft[N]; int find(int x){ return (ft[x]==x) ? x : ft[x]=find(ft[x])原创 2013-05-02 16:49:09 · 559 阅读 · 0 评论 -
Poj 2513 Colored Sticks
欧拉图判定(并查集,端点度数) 离散化Bsearch 1Y #include #include #include #include #define N 250003 using namespace std; struct chop{ char s[12]; bool operator < (const chop &tp)const{return strcmp(s,tp.s)<0;}原创 2013-05-03 22:49:58 · 631 阅读 · 0 评论 -
Poj 2506 Tiling
3Y 前导零wa1 a[0]wa1 ac 结构体内重载真忧伤 #include #include #include using namespace std; #define N 1010 struct BI{ int s[N]; int len; BI() {len=1;memset(s,0,sizeof(s));} BI operator = (cons原创 2013-05-14 20:01:33 · 647 阅读 · 0 评论
分享