8.旅行

摘要: 原题:https://www.acwing.com/problem/content/description/4237/ #pragma GCC optimize(2) #include<iostream> #include<cstring> using namespace std; const in 阅读全文
posted @ 2023-04-10 09:31 skaman 阅读(17) 评论(0) 推荐(0)

7.A计划

摘要: 原题:https://www.acwing.com/problem/content/solution/4236/1/ #include<iostream> #include<cstring> #include<queue> using namespace std; const int N=15,IN 阅读全文
posted @ 2023-04-09 22:11 skaman 阅读(45) 评论(0) 推荐(0)

6.噩梦

摘要: 原题:https://www.acwing.com/problem/content/description/179/ #include<iostream> #include<cstring> #include<queue> using namespace std; #define x first # 阅读全文
posted @ 2023-04-09 20:52 skaman 阅读(33) 评论(0) 推荐(0)

5.DNA序列

摘要: 原题:https://www.acwing.com/problem/content/submission/code_detail/24508041/ 思路:IDA*根据每个字母开搜,也就是由“AGCT”开搜,记录每一个要枚举的字符串的枚举到的下标pos数组,启发函数使用最长的还未匹配的字符串的剩余字 阅读全文
posted @ 2023-04-07 15:33 skaman 阅读(170) 评论(0) 推荐(0)

4.逃跑

摘要: 原题:https://www.acwing.com/problem/content/submission/code_detail/24498789/ 注意可以原地不走,因此要用visited数组判重,队列中也不能仅仅只存坐标。 #pragma GCC optimize (2) #include<io 阅读全文
posted @ 2023-04-07 13:56 skaman 阅读(43) 评论(0) 推荐(0)

3.哈密顿绕行世界问题

摘要: 原题链接:https://www.acwing.com/problem/content/description/4232/ 思路很像全排列,运用压缩状态存储,注意细节 #include<iostream> #include<cstring> #include<algorithm> using nam 阅读全文
posted @ 2023-04-06 22:30 skaman 阅读(32) 评论(0) 推荐(0)

2.八数码二(IDA*)

摘要: 原题链接:https://www.acwing.com/problem/content/4231/ //IDA* #include<iostream> #include<cstring> #include<algorithm> #include<unordered_map> #include<que 阅读全文
posted @ 2023-04-06 17:07 skaman 阅读(22) 评论(0) 推荐(0)

1.八数码

摘要: 原题链接:https://www.acwing.com/problem/content/description/181/ A*的重点在于利用优先队列记录到达当前节点的真实距离加上从当前节点出发到终点的估计距离,用该信息作为第一关键字来处理各个状态。 在四个方向处理时要注意恢复状态。 #include 阅读全文
posted @ 2023-04-06 14:42 skaman 阅读(24) 评论(0) 推荐(0)

13.非常可乐

摘要: 原题链接:https://www.acwing.com/solution/content/90865/ #include<iostream> #include<queue> #include<cstring> using namespace std; const int N=105,INF=0x3f 阅读全文
posted @ 2023-04-04 21:45 skaman 阅读(48) 评论(0) 推荐(0)

14.找路

摘要: 原题链接:https://www.acwing.com/problem/content/description/4230/ #include<iostream> #include<cstring> #include<queue> using namespace std; #define x firs 阅读全文
posted @ 2023-04-04 09:11 skaman 阅读(46) 评论(0) 推荐(0)