
解题报告
文章平均质量分 67
suikay
这个作者很懒,什么都没留下…
展开
-
POJ 1095
这道题感觉上只是一道简单的推理题,它的难点应该是把生成树的规律找出来吧。首先,我们要得到一个节点数为x的二叉树有几种,这里用arr[x]表示。据说有一个叫做卡特兰的公式可以确定这个数组。但实际上只要通过观察即可发现,通过枚举左右子树的数量可以得到arr[x]:for (int i = 0; i 其次,如果一棵树的序号为X,如何确定其节点数:由于题目已经说明:All binary trees having m nodes have numbers less than all those having m+1原创 2011-03-24 12:00:00 · 1644 阅读 · 1 评论 -
1789 Truck History 解题报告
本来以为对最小生成树的学习告一段落了,昨晚跟波波聊的时候他说Prim不一定比Kruskal慢,于是我就拿1789来开刀。果然,于是我先用Kruskal,ac,1641MS,恩,不错.再用Prim写,一交,果然TimeLimitExeeded!!看来波波错了,但是他是已经ac了的..看看他的时间,只有375MS,不算cin的时间消耗他的程序比我快了足足3倍!!看他的解题报告,原来他用的储存结构和我原创 2008-12-22 10:42:00 · 364 阅读 · 0 评论 -
2485 Highways 解题报告 2
AccecptTime: 2008-12-22 11:41:02Language: C++Memory: 596KTime: 157MSErrors:原创 2008-12-22 11:41:00 · 319 阅读 · 0 评论 -
1751 Highways 解题报告 2
AccecptTime: 2008-12-22 11:19:49Language: C++Memory: 2424KTime: 94MSErrors: NoAlgorithm: Prim原创 2008-12-22 11:20:00 · 329 阅读 · 0 评论 -
1751 Highways 解题报告
AccecptTime: 2008-12-20 16:37:39Language: C++Memory: 3516KTime: 485MS + 969MSErrors: 6 TL + 1 CE + 1 MLAlgorithm:原创 2008-12-20 16:54:00 · 489 阅读 · 0 评论 -
2421 Constructing Roads 解题报告
AccecptTime: 2008-12-20 15:13:59Language: C++Memory: 360KTime: 47MSErrors: (10+)RE + (5+)TL +原创 2008-12-20 15:17:00 · 487 阅读 · 0 评论 -
2236
Memory: 396K Time: 0MSLanguage: G+Fault: 2 wa #define M 1440#include#include#includeusing namespace std;int n,m,t;//这里用动态规划算出最早的开始时间用ttime来记录//arrive用来记录车到达的时间int ttime[M],arr原创 2009-03-05 22:37:00 · 543 阅读 · 0 评论 -
2184 Cow Exhibition 解题报告
Memory: 1228KTime: 47MSLanguage: G++Faults: 3 TLE + 2WA + 1 REAlgorithm: dp #includeusing namespace std;#define MID 100050bool in[200100];// 用dp[i]记录smartness为i的情况下funness的最大值// 由于s原创 2009-03-04 19:52:00 · 342 阅读 · 0 评论 -
2081 Recaman's Sequence 水题报告
#include#includeusing namespace std;bool in[10000000];int d[500010];int main(){ int tmp = d[0] = 0; for(int i = 1; i <= 500000; i ++) { if(tmp > i && !in[tmp-i]) tmp -= i;原创 2009-03-04 10:54:00 · 339 阅读 · 0 评论 -
2063 Investment 解题报告
Memory: 612KTime: 16 MSLanguage: G++Faults:2 wa + ...Algorithm: dp /* 由“The value of a bond is always a multiple of $1 000”可以推知 可以把所有的value除以1000来简化dp “The interest of a bond is never more原创 2009-03-04 10:40:00 · 845 阅读 · 0 评论 -
2983 Is the Information Reliable? 解题报告
Memory: 2776KTime: 860MSLanguage: G++Faults:5 wa+1 oleAlgorithm:查分约束/* 这题我是用差分约束做的 求的是最短路,如果有负环 则 inreliable*/#include #include #include using namespace std;#define NIL 100000000#d原创 2009-03-04 09:55:00 · 340 阅读 · 0 评论 -
2485 Highways 解题报告
AccecptTime: 2008-12-18 15:29:04 2008-12-18 15:44:33Language: C++Memory: 600K 688KTime: 375MS 297MSErrors: 2 WAA原创 2008-12-18 18:39:00 · 341 阅读 · 0 评论 -
1258 Agri-Net 解题报告
AccecptTime: 2008-12-18 13:12:04Language: C++Memory: 328KTime: 63MSErrors: 2 WA + 1 CEAlgo原创 2008-12-18 18:31:00 · 342 阅读 · 0 评论 -
2181 Jumping Cows 解题报告
Memory: 304KTime: 94MSLanguage: G++Faults: 0Algorithm: dp/* 这应该也算是dp吧 记录上次odd time的取值 和 even time 的取值 */#includeint main(){ int p,tmp,_neg, pos(0),neg(0); scanf("%d",&p); for(in原创 2009-03-04 11:37:00 · 393 阅读 · 0 评论 -
2346 Lucky tickets 解题报告
Memory: 2612K Time: 63MSLanguage: G++Fault: 0 #include#include//将数分为左右两边,然后用选择原则把一个数出现的情况平方//即左边出现的情况乘以右边同时出现这个数的情况即可int poss[6][100020];int main(){ int N; scanf("%d",&N);原创 2009-03-05 23:18:00 · 427 阅读 · 0 评论 -
2239 Nearest number - 2 解题报告
Memory: 1040KTime: 360MSLanguage: G++Faults: 0Algorithm: dp搜索 #include#include#define MP 40005#define abs(x) (x>0)?x:(-x)//分别用于记录0点的坐标和当前距离最短的点的值int zx[MP],zy[MP],dis[MP],ze[MP];//用于记录原创 2009-03-05 21:39:00 · 472 阅读 · 0 评论 -
1011 Sticks
摘自Poj的warmtrue大牛:1。降序排列,从最长的开始一个个找。如果找的是第一根杆而且最长的没有选到则终止。2。两个相同值,前一个搜索失败后后一个也不用找了。这两条都是搜索经常用到的剪枝,不过我写的时候忽略了第二条,TLE。加了以后32MS就过了。#include #include #include using namespace std;int n,ori_s原创 2009-07-31 16:55:00 · 531 阅读 · 0 评论 -
最长子序列的更优解法
这个算法巧妙之处在于利用了大部分之前的计算的信息。这里开了一个数组,记录最长子序列stack,stack[n]记录长度为n的子序列的最小序列尾数。 举例:原序列为1,5,8,3,6,7 读完8以后,栈为1,5,8,此时读到3,则用3替换5,得到栈中元素为1,3,8, 再读6,用6替换8,得到1,3,6,再读7,得到最终栈为1,3,6,7, 最长递增子序列为长度4。(例子来自于h原创 2009-07-21 16:50:00 · 557 阅读 · 0 评论 -
2954 Triangle 解题报告
/*Pick公式:整点多边形的面积=内部整点个数+边上的整点个数/2 - 1.*/#include#include#includeusing namespace std;int _tmp;void swap(int &x,int &y){ _tmp = x; x = y; y = _tmp;}int gcd(int x,int y){原创 2009-04-18 17:20:00 · 414 阅读 · 0 评论 -
2528 Mayor's posters 解题报告
很久米做线段树的题了,昨天看了一下江离的解题报告。发现一个好东西--离散化,这题里面贴海报的范围很广0~10000000,尝试了几次原始的线段树都mle了。现在的代码可以很轻松的就把它给ac了,这就是离散化的伟大之处... #include#include#includeusing namespace std;#define NIL 10000001#defin原创 2009-04-06 16:37:00 · 613 阅读 · 0 评论 -
3277 City Horizon 解题报告
线段树离散化的第二题,做起来困难重重,wa到快崩溃了。偷看了一下波哥的博客才把它做出来了。活生生的一个山寨。。。今天要把线段树的题目刷完~//这次线段树用的是半开区间,跟以往有些不同//错误主要集中于线段树的insert操作,另外在//map用1为起始下标导致了2+的wa//ERRORS: 5 wa + 3 tle + 1 re#include#include#in原创 2009-04-07 12:18:00 · 618 阅读 · 0 评论 -
POJ 1200 Crazy Search 解题报告
#include#include#include#includeusing namespace std;#define MAX 5000000#define P 3313//用静态链表代替动态链表struct Hash{ int hash; int next;};Hash h[MAX];int c[MAX];char x[MAX];in原创 2009-03-30 14:57:00 · 1937 阅读 · 0 评论 -
POJ 1971 Parallelogram Counting 解题报告
#include#include#include#define MAX 1000#define HMAX 0x3fffff#define P 0x1fffff//将每个中点的x,y都记录下来,如果//同时记录拥有这个中点的线段的个数struct Point{ int x; int y; int count; int next;};Poin原创 2009-03-30 16:53:00 · 1182 阅读 · 0 评论 -
福州oj 1689 未ac
/* 这题应该不难,主要是将种族杀掉不同怪物 数分别做成一个背包,另外是记录杀死n个怪物 * 所需要的能量,但是为什么就ac不了呢。。 */#include#include#includeusing namespace std;int m,n,p;//e[i][j] 用于记录第i个种族杀掉j个怪物所需要的最少能量//用d[i][j]记录前i个种族要杀掉j个怪原创 2009-03-22 13:40:00 · 1207 阅读 · 0 评论 -
1716 Integer Intervals 解题报告
AccecptTime: 2008-12-24 17:47:56 2008-12-24 17:51:06Language: C++Memory: 224K 204KTime: 0MS 32MSErrors: 1 WAAlgo原创 2008-12-24 17:52:00 · 805 阅读 · 3 评论 -
1363 Rails 解题报告
#include#includeusing namespace std;int main(){ bool v[5010],flag1,flag2; int n,tmp; while(cin>>n&&n) { while(cin >> tmp&& tmp) { bool res(true); memset(v,f原创 2009-03-10 17:14:00 · 529 阅读 · 0 评论 -
zoj 1610 count the color
#include#include#includeusing namespace std;#define NoCol 8009#define MulCol -2#define M 8010struct TNode{ int left,right; int col;};TNode t[10*M];void Construct(int pos,原创 2009-03-09 11:25:00 · 620 阅读 · 0 评论 -
2075 Tangled in Cables 解题报告
AccecptTime: 2008-12-21 10:23:25Language: C++Memory: 328KTime: 0MSErrors: 5 WAAlgorithm: Kruskal + sort + bsearch#include #include #include #include using namespace std;// 储存电缆的长度,用名字对应的id来进行记录typ原创 2008-12-21 10:25:00 · 494 阅读 · 0 评论 -
1251 Jungle Roads 解题报告
AccecptTime: 2008-12-18 12:04:07 2008-12-18 12:24:03Language: c++Memory: 292K 292KTime: 0 MSErrors: 3 REAlgorithm:原创 2008-12-18 18:24:00 · 470 阅读 · 0 评论 -
1182解题报告
AccecptTime: 2008-12-17 16:45:59Language: C++Memory: 596KTime: 250MSErrors: 6 WAAlgorithm: 并查集 + 矢量原创 2008-12-17 16:47:00 · 369 阅读 · 0 评论 -
1988解题报告
AccecptTime: 2008-12-17 15:05:08Language: c++ Memory: 556KTime: 219MSErrors: 8 TLE + 4 REAlgorithm:原创 2008-12-17 15:11:00 · 323 阅读 · 0 评论 -
1260 Pearls 解题报告
AccecptTime: 2009-02-04 14:54:57Language: G++Memory: 1004 KTime: 0 msErrors: 3 waAlgorithm: DP这道题咋一看以为是贪心的,但惨痛的wa了3次后恍然大悟.果然是dp的,(或者是我不会用贪心吧原创 2009-02-04 14:58:00 · 522 阅读 · 0 评论 -
1080 Human Gene Functions 解题报告
AccecptTime: 2009-02-04 01:16:09Language: G++Memory: 996KTime: 16 msErrors: 2 waAlgorithm: DP 又做了一道dp题,这题之前在书上看过.写起来很快,但是有一个初始化条件没写好.导致原创 2009-02-04 01:17:00 · 953 阅读 · 0 评论 -
1050 To the Max 解题报告
AccecptTime: 2009-02-03 22:59:35Language: G++Memory: 4100KTime: 1672 msErrors: 1 waAlgorithm: DP 呵呵,这题是最大子序列的衍生题,由一维变二维的.我的做法是用一个二维数原创 2009-02-03 23:18:00 · 439 阅读 · 0 评论 -
1141 Brackets Sequence 解题报告
AccecptTime: 2009-02-03 19:44:50Language: G++Memory: 1064KTime: 0 msErrors: 5 waAlgorithm: DP 这题看者眼熟,但是又做了很久...做了一些DP题后觉得好像主要难在状态的纪原创 2009-02-03 22:04:00 · 433 阅读 · 0 评论 -
1042 Gone Fishing 解题报告
AccecptTime: 2009-02-03 17:02:15Language: G++Memory: 1152KTime: 407MSErrors: 3 waAlgorithm: DP#include #include #include using原创 2009-02-03 16:57:00 · 496 阅读 · 0 评论 -
2479 Maximum sum 解题报告
AccecptTime: 2009-02-03 16:44:05Language: G++Memory: 1808KTime: 547MSErrors: 3WAAlgorithm: DP #include #include #includ原创 2009-02-03 16:38:00 · 491 阅读 · 0 评论 -
ZOJ 2972 Hurdles of 110m 解题报告
AccecptTime: 2009-02-01 16:21:30Language: C++Memory: 184KTime: 0MSErrors: 3 waAlgorithm: DP #include #include #include usin原创 2009-02-01 16:22:00 · 1178 阅读 · 0 评论 -
1730 Perfect Pth Powers 抄题报告
终于ac一道题了...不过这个久违的ac是抄来的...http://hi.baidu.com/zhulei632/blog/item/0877392947e8dcfb99250aef.html觉得这道题很多东西要学,就把自己觉得有用的加个注释~不过这道题也有点太变态了..以前一直以为只有double转int会丢信息,原来int转double也会丢...#include #include #incl原创 2009-01-13 20:53:00 · 434 阅读 · 0 评论 -
1062 昂贵的聘礼 解题报告
AccecptTime: 2009-01-04 17:12:21Language: C++Memory: 296KTime: 0MSErrors: 3WAAlgorithm: Dijkstra最短路径#include #include #include #include原创 2009-01-04 17:14:00 · 1277 阅读 · 1 评论