摘要:
DP,状态为f[i][j][k1][k2],表示第i个人,用了j个男孩,后缀中男生比女生多的数量最大值为k1,女生比男生多的数量最大值为k2.k1,k2 #include #include using namespace std; const int MOD = 12345678; const int maxn = 150 + 10; const int maxk = 20 + 10; long... 阅读全文
摘要:
区间型splay,需要很多种操作。 #include #include #include using namespace std; const int maxn = 4000000 + 10; struct Editor { int l[maxn],r[maxn],f[maxn],s[maxn]; char c[maxn]; int pos,root,cnt; ... 阅读全文
摘要:
DP。 每种排法的长度对应所有循环节长度的最小公倍数。 所以排法总数为和为n的几个数的最小公倍数的总数。 #include #include #include using namespace std; const int maxn = 1000 + 10; int cnt,n; long long f[maxn][maxn]; int prime[maxn]; bool not_pr... 阅读全文
摘要:
最小割,边max为60w条! 虚拟源点连狼,容量为INF,羊连虚拟汇点,容量为INF。 狼和空格向旁边的空格和羊连容量为1的边 #include #include #include using namespace std; const int maxn = 100 + 10; const int maxm = 60000 + 10; const int maxv = 10000 + 1... 阅读全文