搜索
xjsong99
OI -> ACM -> AI
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
POJ2286 The Rotation Game
题目:http://poj.org/problem?id=2286 分析:第一个IDA* 程序。。WA了无数次,原因:判深度超应该放在判合法解之前! 代码:#include <cstdio> #include <algorithm> #include <cstring> #include <vector> using namespace std; const int Tmax=30,p[9][8原创 2015-11-03 19:35:24 · 368 阅读 · 0 评论 -
OpenJudge13 Sticks
题目:http://noi.openjudge.cn/ch0407/13/ 分析:搜索+强剪枝. 代码:#include <cstdio> #include <algorithm> #include <cstring> using namespace std; const int Tmax=70; int n,a[Tmax],ss; bool v[Tmax],ok; bool cmp(int l原创 2015-11-02 16:21:17 · 574 阅读 · 0 评论 -
NOIP2003 神经网络
题目:http://www.luogu.org/problem/show?pid=1038# 分析:以拓扑序进行bfs。我就说两点,只有f[i]>0时才会传递给子节点,只输出大于0的无解要输出NULL! 代码: #include <cstdio> #include <algorithm> #include <cstring> #include &...原创 2015-10-16 17:04:00 · 990 阅读 · 0 评论 -
NOIP2014 寻找道路
题目:http://www.luogu.org/problem/show?pid=2296# 分析:简单图论,搜搜搜,就A了…… 代码: #include <cstdio> #include <algorithm> #include <cstring> #include <vector> #include <queue> usi...原创 2015-06-13 21:46:12 · 922 阅读 · 0 评论 -
NOIP2014 联合权值
题目:http://www.luogu.org/problem/show?pid=1351# 分析:图论,需要进行简单优化,否则TLE 代码: #include <cstdio> #include <algorithm> #include <vector> #include <cstring> using namespace std; co...原创 2015-06-13 21:45:10 · 457 阅读 · 0 评论 -
Codeforces#499 F. Mars rover (两遍dfs)
题目:http://codeforces.com/contest/1011/problem/F 题意: 给一颗逻辑树,求每个输入端改变(0<->1)后,输出端(1)的值 分析: 两遍dfs 第一遍求各点状态 第二遍求各点状态改变后是否反转output(节点1的状态) 代码: #include <bits/stdc++.h> using namespace...原创 2018-07-27 16:06:00 · 254 阅读 · 0 评论 -
HDU6386 Age of Moyu (2018多校第七场1001) (建虚点+堆优化dijkstra)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=6386 题意: n个点m条边,每个边上有一个编号; 从一个编号走到另一个编号,需要代价1; 求1到n的最小代价; 分析: 首先dfs: 对于连通的同一编号的边所连接的点,建立一条边权为1的指向一个虚点的边,同时建立边权为0的由此虚点指向这些点的边; 然后dijk; 复杂度O(m) (雾 ...原创 2018-08-14 11:36:15 · 528 阅读 · 0 评论 -
Codeforces 1105D. Kilani and the Game (双层bfs)
题目: http://codeforces.com/contest/1105/problem/D 题意: n*m的格子,p个人,每个人有若干个堡垒; 每次从1~p轮流行动,一次行动中每个人从已经占领的格子往外走s[p]步能到的格子会全部占领,问结束后每个人能占领多少个格子。 分析: bfs,注意这种bfs的写法。 每个人有一个队列border[i],保存每次扩展后最外围的节点; 另有一个队列Q用来...原创 2019-01-21 20:39:11 · 775 阅读 · 0 评论 -
HDU 3247. Resource Archiver (AC自动机+bfs+DP)
题目: http://acm.hdu.edu.cn/showproblem.php?pid=3247 题意: 给定n个串,将他们放在一个串s中,可以重叠; 给定m个串,要求s中不能出现这m个串; 问s最小多长。 分析: 两篇很好的题解: https://blog.youkuaiyun.com/woshi250hua/article/details/8021283 https://www.cnblogs.com...原创 2019-08-15 11:05:19 · 574 阅读 · 0 评论
分享