andre_joy

导航

2012年7月25日

hdu 1025

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1025题意:上面n个点,下面n个点,然后在这2n个点之间随意连线,一个点只能被连一次,问最多有多少条线不交叉。mark:把上面点排序后,那么就转换成最大升序子序列的问题了。可以看看我上一篇博客~poj 3903代码:#include <stdio.h>#include <string.h>#include <stdlib.h>typedef struct{ int s,e;}city;city c[500010];int len;int d[500010];int c 阅读全文

posted @ 2012-07-25 15:48 andre_joy 阅读(549) 评论(0) 推荐(0) 编辑

poj 3903

摘要: 地址:http://poj.org/problem?id=3903题意:求最长上升子序列。mark:在网上学习一种O(nlgn)的算法,拿过来试验了一下。http://blog.sina.com.cn/s/blog_76344aef0100scyq.html代码:#include <stdio.h>int len;int a[100010];int d[100010];int find(int m){ int fr = 0, la = len-1, mid; while(fr <= la) { mid = (fr+la)/2; if(d[mid] ... 阅读全文

posted @ 2012-07-25 15:30 andre_joy 阅读(234) 评论(0) 推荐(0) 编辑

poj 1185

摘要: 地址:http://poj.org/problem?id=1185题意:中文……mark:经典的状态压缩dp。第一次写,在网上看别人解题报告看了好多,百度一下就有很多。 推荐一个解释很详细的解题报告http://apps.hi.baidu.com/share/detail/14572384 wa了好多次。特别是match函数那,有很多a,b为0的时候的临界情况。 ps:别人的代码不一定是正确的,我找了一篇ac代码,然后比对数据,结果发现他的数据不对。囧……代码:#include <stdio.h>#include <string.h>#define N 61int dp 阅读全文

posted @ 2012-07-25 00:08 andre_joy 阅读(144) 评论(0) 推荐(0) 编辑