- 博客(54)
- 资源 (6)
- 收藏
- 关注
原创 poj2253 解题报告
题意:Freddy Frog暗恋Fiona Frog,在他们之间有n快石头,告诉你这n快石头的坐标,第一快为Freddy Frog的坐标,第n块为Finoa Frog的坐标,Freddy可以借助石头经过任何路径到达Fiona那里,问他最小的弹跳距离是多少题解:用最短路dij做,额,这样说不准确,也可以用最小生成树的prim做,==!这两个本来就是一种思想,只不过松弛方法不一样,其实还可以flo
2012-10-24 15:27:40 543
poj2253 解题报告
题意:Freddy Frog暗恋Fiona Frog,在他们之间有n快石头,告诉你这n快石头的坐标,第一快为Freddy Frog的坐标,第n块为Finoa Frog的坐标,Freddy可以借助石头经过任何路径到达Fiona那里,问他最小的弹跳距离是多少题解:用最短路dij做,额,这样说不准确,也可以用最小生成树的prim做,==!这两个本来就是一种思想,只不过松弛方法不一样,其实还可以flo...
2012-10-24 15:27:00 130
原创 poj3037 解题报告
这道题也是我拿来测板子的题意:给定一个r*c(r题解:可以推出,每个点速度是一样的,这样就直接最短路了 #include #include #include #include #include using namespace std ;const int MAXN = 105 ;const int MAXM = MAXN * MAXN * 20 ;
2012-10-23 22:41:14 465
poj3037 解题报告
这道题也是我拿来测板子的题意:给定一个r*c(r<=100,c<=100)的矩阵,每个元素表示该点高度,给定初始速度v,当从一点移动到另一点后,速度变为原先的2^(该点高度-移动到的点的高度),花费时间是1/原先高度,求从1,1到r,c的最短时间题解:可以推出,每个点速度是一样的,这样就直接最短路了#include <iostream>#include ...
2012-10-23 22:41:00 102
原创 poj3625 解题报告
又是一道最小生成树,拿来测模板;题意:N个点,坐标给出,然后有M条路已经修好了,给出这M条路的起始点和终点,求需要再修多远的路才能得到最小生成树题解:把已经修好的路长度算0,然后最小生成树就好了;话说我wa了一次,题目说了全部用64位的运算,我没看到,把坐标改成longlong就过了好水啊;#include #include #include #include #i
2012-10-22 13:17:57 591
poj3625 解题报告
又是一道最小生成树,拿来测模板;题意:N个点,坐标给出,然后有M条路已经修好了,给出这M条路的起始点和终点,求需要再修多远的路才能得到最小生成树题解:把已经修好的路长度算0,然后最小生成树就好了;话说我wa了一次,题目说了全部用64位的运算,我没看到,把坐标改成longlong就过了好水啊;#include <iostream>#include <cstrin...
2012-10-22 13:17:00 82
原创 poj 2349解题报告
想比赛前吧模板整理好,就做了一道这个题看看模板题意:有P个点,用坐标给出,有两种联系方式:1每个点可以和距离在D以内的点相互联系,2有S个专门的卫星通道,两个点直接联系;求D最小多少可以把这个图连起来题解:首先不考虑S个卫星通道,先求最小生成树,用卫星通道把最小生成树中最大的S-1个边代替掉,然后剩下的最大的那条边的值就是能把整个图连起来的D的最小值#include #in
2012-10-22 12:09:47 601
poj 2349解题报告
想比赛前吧模板整理好,就做了一道这个题看看模板题意:有P个点,用坐标给出,有两种联系方式:1每个点可以和距离在D以内的点相互联系,2有S个专门的卫星通道,两个点直接联系;求D最小多少可以把这个图连起来题解:首先不考虑S个卫星通道,先求最小生成树,用卫星通道把最小生成树中最大的S-1个边代替掉,然后剩下的最大的那条边的值就是能把整个图连起来的D的最小值#include <i...
2012-10-22 12:09:00 89
原创 poj2942 解题报告
本来想下午做完了周末好好玩,结果尼玛做了一晚上...题意:亚瑟王要在圆桌上召开骑士会议,为了不引发骑士之间的冲突,并且能够让会议的议题有令人满意的结果,每次开会前都必须对出席会议的骑士有如下要求:1、 相互憎恨的两个骑士不能坐在直接相邻的2个位置;2、 出席会议的骑士数必须是奇数,这是为了让投票表决议题时都能有结果。 如果出现有某些骑士无法出席所有会议(例如这个骑士憎恨
2012-10-19 17:21:12 547
poj2942 解题报告
本来想下午做完了周末好好玩,结果尼玛做了一晚上...题意:亚瑟王要在圆桌上召开骑士会议,为了不引发骑士之间的冲突,并且能够让会议的议题有令人满意的结果,每次开会前都必须对出席会议的骑士有如下要求:1、 相互憎恨的两个骑士不能坐在直接相邻的2个位置;2、 出席会议的骑士数必须是奇数,这是为了让投票表决议题时都能有结果。如果出现有某些骑士无法出席所有会议(例如这个骑士憎恨所有的...
2012-10-19 17:21:00 86
原创 poj1523 解题报告
题意:给出一个无向图,要求找出每个割点,以及除去割点之后能把图分成几个连通块题解:点的双联通,统计割点属于多少个连通块代码:#include #include #include using namespace std ;const int MAXN = 1005 ;struct type{ int end , next ;} ;t
2012-10-18 15:07:41 447
poj1523 解题报告
题意:给出一个无向图,要求找出每个割点,以及除去割点之后能把图分成几个连通块题解:点的双联通,统计割点属于多少个连通块代码:#include <iostream>#include <cstring>#include <cstdio>using namespace std ;const int MAXN = 1005 ;st...
2012-10-18 15:07:00 97
原创 poj2186 解题报告
题意:有一些奶牛,他们之间有互相崇拜的关系,并且这个关系是有传递性的,求被所有奶牛崇拜的奶牛数量;题解:先用强连通缩点,把强连通分量缩成一个点,强连通中的点必然是互相崇拜的,然后再缩点后的图中找到出度为零的点,如果这些点的数量大于一,那么必然没有解,因为这些点直接没有互相崇拜关系,如果只有一个点,那么求出这个点对应的强连通分量里面的点的个数就是答案了;代码搓了点:#includ
2012-10-18 10:45:38 285
poj2186 解题报告
题意:有一些奶牛,他们之间有互相崇拜的关系,并且这个关系是有传递性的,求被所有奶牛崇拜的奶牛数量;题解:先用强连通缩点,把强连通分量缩成一个点,强连通中的点必然是互相崇拜的,然后再缩点后的图中找到出度为零的点,如果这些点的数量大于一,那么必然没有解,因为这些点直接没有互相崇拜关系,如果只有一个点,那么求出这个点对应的强连通分量里面的点的个数就是答案了;代码搓了点:#includ...
2012-10-18 10:45:00 55
原创 codeforces 145 div2 A
这道题我比赛的时候懵了,那么简单一道题,我还想成了网络流相关。。。sb了,,,#include #include #include #include using namespace std ;ifstream fin ( "input.txt" ) ;ofstream fout ( "output.txt" ) ;int n ;char stude
2012-10-17 14:31:05 288
codeforces 145 div2 A
这道题我比赛的时候懵了,那么简单一道题,我还想成了网络流相关。。。sb了,,,#include <iostream>#include <fstream>#include <cstring>#include <cstdio>using namespace std ;ifstream fin ( "input.txt" ) ;...
2012-10-17 14:31:00 93
原创 zoj3659
这道题是长春的E题,我是看了别人才会做的,这道题是一个并查集的题,将边按从大到小排序,然后依次合并,这样每次都是按边的权值来计算合并后的值,接下来就是讨论这两个集合谁并入谁,应该是合并后所得值小的并入值大的,这样就要记录每个集合当前元素个数sum和当前值rank#include #include #include #include using namespace std
2012-10-17 11:22:15 314
zoj3659
这道题是长春的E题,我是看了别人才会做的,这道题是一个并查集的题,将边按从大到小排序,然后依次合并,这样每次都是按边的权值来计算合并后的值,接下来就是讨论这两个集合谁并入谁,应该是合并后所得值小的并入值大的,这样就要记录每个集合当前元素个数sum和当前值rank#include <iostream>#include <cstring>#include &...
2012-10-17 11:22:00 74
原创 关于poj的题目
我在poj写了175题,都是以前写的,都木有写解题报告==!我今天才想起来写解题报告,写了几篇发现太多了。。。。我就把代码打包上传到资源页去了,以后就只写刚做的题的报告了
2012-10-16 22:27:08 261
关于poj的题目
我在poj写了175题,都是以前写的,都木有写解题报告==!我今天才想起来写解题报告,写了几篇发现太多了。。。。我就把代码打包上传到资源页去了,以后就只写刚做的题的报告了...
2012-10-16 22:27:00 43
原创 codeforces 145DIV2 B 解题报告
我第一次做codeforces的比赛,以前都在半夜,太懒了就不做,终于有rating了,1421第一题想懵了,不想做了,看了下第二题,大水题,就是排一下序,找前几的序号,由于不熟悉它的输入输出re了一次wa了一次,我太水了#include #include #include #include using namespace std ;ifstream fin (
2012-10-16 21:30:33 799
codeforces 145DIV2 B 解题报告
我第一次做codeforces的比赛,以前都在半夜,太懒了就不做,终于有rating了,1421第一题想懵了,不想做了,看了下第二题,大水题,就是排一下序,找前几的序号,由于不熟悉它的输入输出re了一次wa了一次,我太水了#include <iostream>#include <cstring>#include <algorithm>#i...
2012-10-16 21:30:00 69
原创 poj2942解题报告
这道题其实就是求割点数量用点双联通#include #include #include #include using namespace std ;const int MAXN = 1001 ; const int MAXM = 2*MAXN * MAXN ; const int INF = 99999999 ; struct type {
2012-10-16 13:09:48 252
poj2942解题报告
这道题其实就是求割点数量用点双联通#include <iostream>#include <cstring>#include <cstdio>#include <stack>using namespace std ;const int MAXN = 1001 ; const int MAXM = 2*MAXN * ...
2012-10-16 13:09:00 52
原创 poj1523解题报告
题意就是要求割点用tarjan求强连通#include #include using namespace std ;const int MAXN = 1100 ; const int MAXM = MAXN * MAXN ; struct type{ int to , next ; } ; type edge[MAXM] ; int
2012-10-16 13:04:10 259
poj1523解题报告
题意就是要求割点用tarjan求强连通#include <iostream>#include <cstring>using namespace std ;const int MAXN = 1100 ; const int MAXM = MAXN * MAXN ; struct type{ int to , next ; } ...
2012-10-16 13:04:00 75
原创 poj2914解题报告
这是一个全局最小割的题:#include #include #include #include using namespace std ;const int INF = 999999999 ; const int MAXN = 505 ; int map[MAXN][MAXN] , low[MAXN] , vis[MAXN] , last , pre ,
2012-10-16 12:05:30 252
poj2914解题报告
这是一个全局最小割的题:#include <iostream>#include <cstring>#include <cstdio>#include <queue>using namespace std ;const int INF = 999999999 ; const int MAXN = 505 ; in...
2012-10-16 12:05:00 172
原创 poj1273解题报告
经典网络流sap:#include #include #include #include using namespace std ;const int MAXN = 500 ;const int MAXM = 25000 ;const int INF = 9999999 ;int map[MAXN+10][MAXN+10] ;int dis
2012-10-16 12:02:50 283
poj1273解题报告
经典网络流sap:#include <iostream>#include <cstring>#include <queue>#include <stack>using namespace std ;const int MAXN = 500 ;const int MAXM = 25000 ;const int I...
2012-10-16 12:02:00 59
原创 poj2533解题报告
题意:最长上升子序列题解:虽然是经典dp,但我用网络流做啊,dp我一点不懂啊怎么办#include #include #include #include using namespace std ;const int INF = 99999999 ;const int MAXN = 1505 ; const int MAXM = MAXN * 100 ;
2012-10-16 11:59:19 264
poj2533解题报告
题意:最长上升子序列题解:虽然是经典dp,但我用网络流做啊,dp我一点不懂啊怎么办#include <iostream>#include <cstring>#include <cstdio>#include <queue>using namespace std ;const int INF = 99999999 ;...
2012-10-16 11:59:00 75
原创 poj2524解题报告
这题也是并查集,最近并查集写的有点多 #include #include #include using namespace std ;int father[50005] ;int find( int x ){ if( father[x] != x ) father[x] = find( father[x] ) ; return fat
2012-10-16 11:53:03 275
poj2524解题报告
这题也是并查集,最近并查集写的有点多#include <iostream>#include <cstring>#include <cstdio>using namespace std ;int father[50005] ;int find( int x ){ if( father[x] != x ) fat...
2012-10-16 11:53:00 51
原创 poj2236解题报告
题意:有N个点;多条路;事先每个点都被摧毁;输入两个数字A,B代表这两个点有一条路,字符O和数字A,代表修复这个点;若输入S,A,B代表询问A,B是否连通;题解:并查集#include #include #include using namespace std ;const int MAXN = 1005 ;struct type{ int x ,
2012-10-16 11:49:07 338
poj2236解题报告
题意:有N个点;多条路;事先每个点都被摧毁;输入两个数字A,B代表这两个点有一条路,字符O和数字A,代表修复这个点;若输入S,A,B代表询问A,B是否连通;题解:并查集#include <iostream>#include <cstring>#include <cstdio>using namespace std ;const int...
2012-10-16 11:49:00 128
原创 poj1611解题报告
#include #include #include #include using namespace std ;const int MAXN = 30005 ;int father[MAXN] ;int find( int x ){ if( father[x] != x ) father[x] = find( father[x] )
2012-10-16 11:44:51 254
poj1611解题报告
#include <iostream>#include <algorithm>#include <cstring>#include <cstdio>using namespace std ;const int MAXN = 30005 ;int father[MAXN] ;int find( int x...
2012-10-16 11:44:00 70
原创 poj1703解题报告
题意:T代表case数量,N代表N个人,M代表将要输入M组关系,每组关系有一个字符和两个整数ch,A,B,如果ch是‘A’,代表询问A,B是否是同一集合,‘D’代表A和B是同一集合题解:并查集#include #include #include using namespace std ;const int INF = 99999999 ;const int MAX
2012-10-16 11:41:25 314
poj1703解题报告
题意:T代表case数量,N代表N个人,M代表将要输入M组关系,每组关系有一个字符和两个整数ch,A,B,如果ch是‘A’,代表询问A,B是否是同一集合,‘D’代表A和B是同一集合题解:并查集#include <iostream>#include <cstring>#include <cstdio>using namespace std ;...
2012-10-16 11:41:00 80
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人