摘要:原题:https://www.acwing.com/problem/content/description/4237/ #pragma GCC optimize(2) #include<iostream> #include<cstring> using namespace std; const in
阅读全文
摘要:原题:https://www.acwing.com/problem/content/solution/4236/1/ #include<iostream> #include<cstring> #include<queue> using namespace std; const int N=15,IN
阅读全文
摘要:原题:https://www.acwing.com/problem/content/description/179/ #include<iostream> #include<cstring> #include<queue> using namespace std; #define x first #
阅读全文
摘要:原题:https://www.acwing.com/problem/content/submission/code_detail/24508041/ 思路:IDA*根据每个字母开搜,也就是由“AGCT”开搜,记录每一个要枚举的字符串的枚举到的下标pos数组,启发函数使用最长的还未匹配的字符串的剩余字
阅读全文
摘要:原题:https://www.acwing.com/problem/content/submission/code_detail/24498789/ 注意可以原地不走,因此要用visited数组判重,队列中也不能仅仅只存坐标。 #pragma GCC optimize (2) #include<io
阅读全文
摘要:原题链接:https://www.acwing.com/problem/content/description/4232/ 思路很像全排列,运用压缩状态存储,注意细节 #include<iostream> #include<cstring> #include<algorithm> using nam
阅读全文
摘要:原题链接:https://www.acwing.com/problem/content/4231/ //IDA* #include<iostream> #include<cstring> #include<algorithm> #include<unordered_map> #include<que
阅读全文
摘要:原题链接:https://www.acwing.com/problem/content/description/181/ A*的重点在于利用优先队列记录到达当前节点的真实距离加上从当前节点出发到终点的估计距离,用该信息作为第一关键字来处理各个状态。 在四个方向处理时要注意恢复状态。 #include
阅读全文
摘要:原题链接:https://www.acwing.com/solution/content/90865/ #include<iostream> #include<queue> #include<cstring> using namespace std; const int N=105,INF=0x3f
阅读全文
摘要:原题链接:https://www.acwing.com/problem/content/description/4230/ #include<iostream> #include<cstring> #include<queue> using namespace std; #define x firs
阅读全文
摘要:原题链接:https://www.acwing.com/problem/content/description/4228/ //简单Flood Fill #include<iostream> #include<cstring> #include<queue> using namespace std;
阅读全文
摘要:原题链接:https://www.acwing.com/problem/content/description/1078/ #include<iostream> #include<cstring> #include<vector> using namespace std; #define x fir
阅读全文
摘要:原题链接:acwing.com/problem/content/submission/4227/ #include<iostream> #include<cstring> #include<queue> using namespace std; typedef pair<int,int> PII;
阅读全文
摘要:原题链接:https://www.acwing.com/problem/content/description/4226/ #include<iostream> #include<cstring> #include<queue> using namespace std; const int N=15
阅读全文
摘要:原题链接:https://www.acwing.com/problem/content/description/4225/ #include<bits/stdc++.h> using namespace std; struct Operator{ int x,y; }; int a,b,c; int
阅读全文
摘要:原题链接:https://www.acwing.com/problem/content/description/4224/ #include<bits/stdc++.h> using namespace std; string a,b,c; unordered_map<string,int> dis
阅读全文