09 2024 档案
摘要:我的天,折半搜索(meet in the middle),依稀记得我学过,但是真的不记得。。。。 从状态图上起点和终点同时开始进行宽度/深度优先搜索,如果发现相遇了,那么可以认为是获得了可行解。 这道题,每一个元素会有3种状态,分别是在第一个集合或者第二个集合亦或者不在集合中。如果直接暴力去搜的话,
阅读全文
摘要:最小生成树+最短路+并查集维护 题目 #include<bits/stdc++.h> #define int long long using namespace std; const int N=2e5+100,M=N*2; int n,m,s; int h[N],e[M],ne[M],w[M],i
阅读全文
摘要:贪心 #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e3+100; int n,m; struct NODE{ int l,r,val; bool operator < (const N
阅读全文