摘要: ###可持久化线段树2 #include<cstdio> #include<iostream> #include<algorithm> using namespace std; const int MAXN=1e6+5; struct ren{ int l,r,sum; }t[MAXN<<5]; i 阅读全文
posted @ 2022-02-22 16:49 StranGePants 阅读(14) 评论(0) 推荐(0) 编辑
摘要: P2617 #include<cstdio> #include<vector> #include<iostream> #include<algorithm> using namespace std; const int MAXN=1e5+5; int n,m,Ans[MAXN<<2],cg[MAXN 阅读全文
posted @ 2022-02-16 21:47 StranGePants 阅读(34) 评论(0) 推荐(0) 编辑
摘要: ##POJ2104 code: #include<cstdio> #include<vector> #include<iostream> #include<algorithm> using namespace std; const int MAXN=1e5+5; int n,m,Ans[MAXN], 阅读全文
posted @ 2022-02-16 20:20 StranGePants 阅读(22) 评论(0) 推荐(0) 编辑
摘要: ##Building Bridges code: #include<cstdio> #include<iostream> #include<algorithm> using namespace std; #define int long long const int MAXN=2e5+5; int 阅读全文
posted @ 2022-02-13 15:14 StranGePants 阅读(57) 评论(0) 推荐(0) 编辑
摘要: Description CF285E Positions in Permutations 题意:给定 \(n\) 和 \(k\),求出满足 \(\sum_{i=1}^n[|p_i-i|=1]\) 的 \(n\) 的排列 \(p\) 的数量。 Solution 前置芝士:二项式反演,线性 \(dp\) 阅读全文
posted @ 2021-12-15 21:48 StranGePants 阅读(48) 评论(0) 推荐(1) 编辑
摘要: Description [JSOI2011]分特产 前置芝士:二项式反演 题意:给定 \(m\) 种物品,每种物品有 \(m_i\) 个且同种物品均相同,求放进 \(n\) 个不同盒子,每个盒子非空的方案数。 Solution 假设每个盒子先铺一个物品,因为每种物品个数有限制,所以把方案建立在盒子非 阅读全文
posted @ 2021-12-14 21:55 StranGePants 阅读(45) 评论(5) 推荐(1) 编辑
摘要: Description CF1227F2 Wrong Answer on test 233 (Hard Version) 题目大意就是给定一个序列 \(h\),问有多少序列 \(a\),满足 \(a\) 与 \(h\) 的相似度小于 \(a\) 与 \(h\) 左移后的相似度。 或者你叫汉明距离也行 阅读全文
posted @ 2021-11-27 15:53 StranGePants 阅读(54) 评论(0) 推荐(2) 编辑
摘要: Description CF451E Devu and Flowers 有限制多重集组合模板题。 可转化题目 有 \(n\) 种盒子,每个盒子可以放的小球数最多为 \(f_i\),盒子可为空,求总共放 \(s\) 个球的方案数,答案对 1e9+7 取模。 发现直接求方案不好做,但是总方案和不合法的方 阅读全文
posted @ 2021-11-18 22:21 StranGePants 阅读(65) 评论(0) 推荐(4) 编辑
摘要: Description 如果你做过 CF16E 和 CF540D 的话,那么恭喜你,这道题你 A 了。 因为1是一定在最后胜利的,所以我们考虑倒推,又因为 \(n\leq18\),容易想到状压。 设 \(dp[i]({i|i\in [1,2^n-1]})\) 表示目前存活的人的集合为 i 时,1获胜 阅读全文
posted @ 2021-09-29 21:53 StranGePants 阅读(69) 评论(0) 推荐(2) 编辑
摘要: Description Link 给定一棵树,选其中的一些点使每条边都与至少一个所选点相邻。 在满足上述条件的情况下,使得被两个点同时相邻的边最多。 其中 \(1\leq n\leq10^3\)。 Solution 经典的换根 DP。 如果只考虑要求 1,设 \(dp[i][0]\) 表示 i 选不 阅读全文
posted @ 2021-08-17 22:32 StranGePants 阅读(47) 评论(0) 推荐(0) 编辑