
poj
文章平均质量分 68
NaCl__
这个作者很懒,什么都没留下…
展开
-
Crazy Search(POJ1200)
DescriptionMany people like to solve hard puzzles some of which may lead them to madness. One such puzzle could be finding a hidden prime number in a given text. Such number could be the number of diff原创 2015-07-25 10:15:10 · 462 阅读 · 0 评论 -
poj2524 Ubiquitous Religions
题目链接:http://poj.org/problem?id=2524 这题是求联通块。我们可以用并查集来做。不过要记得合并的时候要有序的合并,然后在枚举父亲节点,看看有多少点是在该点管辖下。然后再标记起来就ok啦~ 不过在写find函数的时候顺带把路径也压缩压缩。不然会TLE ==#include<stdio.h> #include<string.h> #include<iostream> #原创 2016-04-29 16:55:05 · 406 阅读 · 0 评论 -
POJ 3764
题目链接:http://poj.org/problem?id=3764 这题的题意是让你找一条路径,那条路径的点额权值异或得到的结果要最大。题目给出n-1条边,说明这个图是个联通图。我们可以用dfs求出从节点0开始到每一个点通过的路径上的异或值,用val[]来保存。然后利用字典树。把val[]的值一位一位的插入的01字典树中。然后再查找。找到最大值。#include <stdio.h> #incl原创 2016-05-13 17:07:42 · 532 阅读 · 0 评论 -
poj 1679 The Unique MST
题目要判断最小生成树是不是是唯一的。 先用prim算法求出最小生成树。然后将加进最小生成树的边用used数组标记起来,并且记录下i-j点的最大权值。然后在枚举那些没加进生成树的边。看是否也能得到同样的权值。如果能说明不唯一 比如used[i][j]==0说明i-j这条边没加进去然后更新Min。 #include #include #include #include using namesp原创 2016-07-28 11:25:50 · 383 阅读 · 0 评论 -
poj3723 Conscription
又到了写文章骂自己SB的时候。。。 这题的题意是某个人要找N个女孩和M个男孩。每个人需要付10000RMB。不过女孩x和男孩y有关联。当关联的人被招去了。那么剩下的那个人就可以在以dRMB找到。现在问你最小的招聘代价是多少。。 #include #include #include #include #include #include #include using namespace std;原创 2016-07-30 22:20:39 · 431 阅读 · 0 评论