文章分类 -  acm搜索-bfs

hdu2850(2009多校第四场) n个数放在m个集合使(最大-最小)最小 优先队列贪心
摘要:从大到小排序,每次选择用时最少的集合==这尼玛是一个错误的贪心6 27000 5000 3000 3000 3000 3000就跪了gg不过网上也没有正解,就这样水过去吧2333 1 #include 2 #include 3 #include 4 #include 5 using namespac... 阅读全文

posted @ 2014-12-16 17:46 xiao_xin 阅读(144) 评论(0) 推荐(0)

hdu5102 单位边权树上的前k长路径和:队列技巧
摘要:单向拓展边orz题解== 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int next[200005],head[200005],point[200005],now; 7 void add(int x,in... 阅读全文

posted @ 2014-11-09 00:14 xiao_xin 阅读(237) 评论(0) 推荐(0)

hdu5094(上海邀请赛E) 状态压缩bfs:取钥匙开门到目的地
摘要:貌似和前段时间的一场网络赛一个类型,状态压缩判断走没走过,然后裸bfs到终点。其实这类题目很简单就是一个bfs模板,无非就是有一些坑,比如这一题。。一个格子可以有多把钥匙汗== 1 #include 2 #include 3 #include 4 #include 5 using namespace... 阅读全文

posted @ 2014-11-02 19:54 xiao_xin 阅读(122) 评论(0) 推荐(0)

hdu5040 优先队列bfs(较烦)
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 char face[]={'E','S','W','N'},map[505][505]; 7 int fac[505][505],vis[505][505][4... 阅读全文

posted @ 2014-09-25 21:01 xiao_xin 阅读(126) 评论(0) 推荐(0)

hdu4474 bfs求k的最小的倍数(巧妙)
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int pre[10010],num[10010],a[10005],n; 7 void print(int x) 8 { 9 if (pre[x]!=... 阅读全文

posted @ 2014-09-09 23:22 xiao_xin 阅读(131) 评论(0) 推荐(0)

hdu1242 优先队列bfs
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 typedef struct dian 6 { 7 friend bool operatorn2.time);10 }11 int x,y,time;12 }... 阅读全文

posted @ 2014-07-16 16:26 xiao_xin 阅读(106) 评论(0) 推荐(0)

hdu2531 bfs
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 int xx[4]={0,0,1,-1}; 6 int yy[4]={1,-1,0,0}; 7 int used[125][125],hash[125][125],sum,n,m; ... 阅读全文

posted @ 2014-07-16 14:33 xiao_xin 阅读(114) 评论(0) 推荐(0)

导航