
状态压缩
白之月
这个作者很懒,什么都没留下…
展开
-
蓝桥杯 剪邮票(超详解)
思路:二进制枚举所有情况dfs判断连通块(或者可以枚举,五个数的组合数,然后判断是否联通)#include<iostream>#include<cstdio>#include<cstring>using namespace std;const int N=20;bool check(int state);bool check1(int state);int lowbit(int x);void dfs(int x, int y);int ans;原创 2021-04-01 21:22:15 · 274 阅读 · 0 评论 -
HDU 5023(线段树染色)(两种方法)(非状压,巧妙得到状态)(状压得到状态)(超详解)
思路:用线段树去维护,修改的区间,并染上色。当询问某一个区间时,可以把当前区间内的所有色全存到数组里,最后排序去重,输出。#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<vector> using namespace std;typedef long long LL;const int N=1e6+10;struct原创 2021-03-29 20:58:24 · 297 阅读 · 0 评论