这个人不懒,但还是什么都没写
AC 1k道
https://www.luogu.me/article/km0mgjjl 贪心
https://www.cnblogs.com/wyb-sen/p/17234499.html trick合集
https://www.cnblogs.com/cyl06/p/SOSDP.html
高维前缀和(枚举子/超集)
https://blog.csdn.net/Ymy251325/article/details/140898645 康托展开
https://oi-wiki.org/graph/min-cycle/ 找最小环
https://blog.csdn.net/Mr_dimple/article/details/123428117 Floyd找最小环
https://blog.csdn.net/weixin_42001089/article/details/84327306 topu排序判环
https://www.luogu.com.cn/article/hi7d09cv topu找最长路
https://www.luogu.com.cn/article/jjg8xkxe 01分数规划
https://www.cnblogs.com/dengstar/p/18698407 排序不等式
https://blog.csdn.net/shulianghan/article/details/109438773 错排公式
枚举子集
for(int sta=0;sta<(1<<N);sta++) //枚举集合
{
F[sta]=A[0];
for(int i=sta;i>0;i=(i-1)&sta)//枚举子集
F[sta]+=A[i];
}枚举全排列
for(int i=1;i<=n;i++) id[i]=i;//id数组为枚举的全排列
do{
// code
}while(next_permutation(id+1,id+1+n));NO tips:
s[++cnt]=s[cnt-1]+i.b;会死
Yes tips:
-
求
最大值最小等要先想想二分 -
可以先考虑答案跟输入的关系,缩小数据范围
-
优化最小生成树的题不要只考虑贪心,可以考虑减少边再跑kruskal
-
BFS 按层级遍历,天然保证距离最小
-
复杂度要考虑每个点会遍历几次,例如20连小恐龙
-
求按照某种顺序排序的方案时,想topu,例如P6286
-
^是不进位加法,也是不借位减法 -
离散化
unique减 1 -
减法加 mod
-
请想想二分吧
-
树状数组加是加 lowbit,查询是减 lowbit
-
__builtin_popcount() 复杂度 O(1)
-
nth_element(first,kth,second),将第 kth 小元素放在第k位,左边的全小于,右边全大于。复杂度 O(n)
-
(n,2*n) 中必有质数
-
有时候不需要知道过程怎么走,只关注结果就行。
-
dp 可以先写暴力 dp,在考虑优化。

