上一页 1 2 3 4 5 6 7 ··· 35 下一页
摘要: ###题目链接:https://codeforces.com/problemset/problem/803/F 按莫比乌斯函数系数容斥即可,统计 \(gcd\) 至少为 \(i\) 的子序列的数量,即 \(i\) 的倍数的数选或不选,方案数为 \(2^{size[i]}-1\) 统计序列中 \(i\ 阅读全文
posted @ 2021-09-08 17:21 Tartarus_li 阅读(46) 评论(0) 推荐(0) 编辑
摘要: ###题目链接: \(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 阅读(28) 评论(0) 推荐(0) 编辑
摘要: ###题目链接: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 阅读(42) 评论(0) 推荐(0) 编辑
摘要: ###题目链接: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 阅读(108) 评论(0) 推荐(0) 编辑
摘要: ###题目链接:https://codeforces.com/contest/1556/problem/F 可以证明,一定存在胜利者,且胜利者们在同一个强连通分量中(反证法),所以考虑枚举胜利者 设 \(dp[winners]\) 表示胜利者为 \(winners\) 的概率,则期望为 \(\sum 阅读全文
posted @ 2021-09-07 22:26 Tartarus_li 阅读(63) 评论(0) 推荐(0) 编辑
摘要: ###题目链接: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 阅读(58) 评论(0) 推荐(0) 编辑
摘要: ###题目链接: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 阅读(27) 评论(0) 推荐(0) 编辑
摘要: ###题目链接: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 阅读(28) 评论(0) 推荐(0) 编辑
摘要: ###题目链接:https://www.luogu.com.cn/problem/UVA11987 唯一需要考虑的就是操作二,将某元素从一个并查集移动到另一个并查集中 建立一个新节点代表该元素,将原来的元素留在原位,原来的并查集减掉,新的并查集加上即可 #include<bits/stdc++.h> 阅读全文
posted @ 2021-09-04 21:46 Tartarus_li 阅读(37) 评论(0) 推荐(0) 编辑
摘要: ###题目链接: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 阅读(44) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 35 下一页