会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Tartarus
醉后不知天在水,满船清梦压星河。
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
···
35
下一页
2021年9月8日
codeforces 803 F. Coprime Subsequences (莫比乌斯反演)
摘要: ###题目链接:https://codeforces.com/problemset/problem/803/F 按莫比乌斯函数系数容斥即可,统计 \(gcd\) 至少为 \(i\) 的子序列的数量,即 \(i\) 的倍数的数选或不选,方案数为 \(2^{size[i]}-1\) 统计序列中 \(i\
阅读全文
posted @ 2021-09-08 17:21 Tartarus_li
阅读(65)
评论(0)
推荐(0)
2021年9月7日
UVa 12716 GCD XOR (数论+bitmask)
摘要: ###题目链接: \(gcd(a,b) = a \oplus b\) \(a \oplus b=c\) 可以写成 \(a \oplus c=b\),于是 \(c\) 是 \(a\) 的因数 进一步可以发现,满足 \(gcd(a,b) = a \oplus b = c\) 的三元组 \((a,b,c)
阅读全文
posted @ 2021-09-07 23:29 Tartarus_li
阅读(35)
评论(0)
推荐(0)
codeforces 1556D - Take a Guess (构造+bitmasks)
摘要: ###题目链接:https://codeforces.com/blog/entry/94384 重要结论: \(a+b = (a \space or\space b)+(a\space and\space b)\)
阅读全文
posted @ 2021-09-07 23:24 Tartarus_li
阅读(64)
评论(0)
推荐(0)
codeforces 1556 E. Equilibrium (线段树)
摘要: ###题目链接:https://codeforces.com/contest/1556/problem/E 令 \(c[i] = a[i]-b[i]\),将对 \(a\) 的操作看作 \(+1\),对 \(b\) 的操作看作 \(-1\),奇数位加,偶数位减,可以想到括号序列,\(c[i]<0\),
阅读全文
posted @ 2021-09-07 23:18 Tartarus_li
阅读(133)
评论(0)
推荐(0)
codeforces 1556F - Sports Betting (概率dp)
摘要: ###题目链接:https://codeforces.com/contest/1556/problem/F 可以证明,一定存在胜利者,且胜利者们在同一个强连通分量中(反证法),所以考虑枚举胜利者 设 \(dp[winners]\) 表示胜利者为 \(winners\) 的概率,则期望为 \(\sum
阅读全文
posted @ 2021-09-07 22:26 Tartarus_li
阅读(85)
评论(0)
推荐(0)
codeforces 1567E Non-Decreasing Dilemma (线段树)
摘要: ###题目链接:https://codeforces.com/contest/1567/problem/E 维护每个位置所在的连续不降序列的左端点 \(p[i]\),容易发现是单调不降的 答案就是 \(\frac{(l+r)\times(r-l+1)}{2}+(r-l+1)-\sum_l^r p[i
阅读全文
posted @ 2021-09-07 20:15 Tartarus_li
阅读(67)
评论(0)
推荐(0)
2021年9月6日
UVa 1502 GRE Words (DP+AC自动机+jry线段树)
摘要: ###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=448&page=show_problem&problem=4248 待填坑
阅读全文
posted @ 2021-09-06 11:08 Tartarus_li
阅读(35)
评论(0)
推荐(0)
2021年9月5日
UVa 1076 Password Suspects (AC自动机+状压dp)
摘要: ###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3517 生成文本,要求含或不含某些连续子串的题目一般是 \(AC\) 自动机 \(+\) \(dp
阅读全文
posted @ 2021-09-05 19:58 Tartarus_li
阅读(42)
评论(0)
推荐(0)
2021年9月4日
UVA 11987 Almost Union-Find (并查集+技巧)
摘要: ###题目链接:https://www.luogu.com.cn/problem/UVA11987 唯一需要考虑的就是操作二,将某元素从一个并查集移动到另一个并查集中 建立一个新节点代表该元素,将原来的元素留在原位,原来的并查集减掉,新的并查集加上即可 #include<bits/stdc++.h>
阅读全文
posted @ 2021-09-04 21:46 Tartarus_li
阅读(71)
评论(0)
推荐(0)
UVa 12232 Exclusive-OR (带权并查集)
摘要: ###题目链接:https://www.luogu.com.cn/problem/UVA12232 对于条件 \(p \oplus q = v\),将 \(p\) 所在并查集和 \(q\) 所在并查集合并,权值为 \(d[p] \oplus d[q]\oplus v\) 即可 对于条件 \(p =
阅读全文
posted @ 2021-09-04 21:22 Tartarus_li
阅读(57)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
···
35
下一页
公告