会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
TaopiTTT
双指针优化二维前缀和
摘要: 先看例题https://www.luogu.com.cn/problem/P8783 由题意可以快速写出一个
n
4
复杂度的二维前缀和,如下 for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ for(int x=i;x<=n;x++){ for(int
阅读全文
posted @ 2025-02-19 19:52 TaopiTTT
阅读(3)
评论(0)
推荐(0)
编辑
质因数分解+状态压缩求完全平方数
摘要: 例题https://www.luogu.com.cn/problem/P10724 小性质:完全平方数的质因子出现数量应该为偶数,因此可以用异或去判断是否为偶数 前缀异或和性质: 因为:
a
x
o
r
a
=
0
,而且异或满足交换律。 所以当前的前缀异或
s
x
o
r
之前出现过,说明中间的那些\(
阅读全文
posted @ 2024-11-26 19:23 TaopiTTT
阅读(18)
评论(0)
推荐(0)
编辑
形如求某一数字的倍数的方案数的题
摘要: 例题:https://ac.nowcoder.com/acm/contest/95928/D 题意简析:在数组中选取两个数
a
i
,
a
j
,使得两数乘积为495的倍数,同时可以进行一次(仅一次)的操作:使某个
a
i
加1,求出最大方案数 思路:通常遇到这种题目,需要对目标数进行质因数
阅读全文
posted @ 2024-11-25 22:00 TaopiTTT
阅读(5)
评论(0)
推荐(0)
编辑
维护带权并查集
摘要: 大概叫这个名字吧 https://atcoder.jp/contests/abc380/tasks/abc380_e #include<bits/stdc++.h> #define endl '\n' #define lowbit(x) (x&-x) using namespace std; typ
阅读全文
posted @ 2024-11-25 21:34 TaopiTTT
阅读(4)
评论(0)
推荐(0)
编辑
从一道很水的题窥探动态规划优化技巧
摘要: 原题:https://www.luogu.com.cn/problem/P1776 这题虽然标绿,但是数据极水,通过解绑优化即可卡着1s时限通过 未优化代码: const int N=1e5+5; int v[N],w[N],m[N]; int dp[N]; void solve(){ int n,
阅读全文
posted @ 2024-11-14 20:49 TaopiTTT
阅读(10)
评论(0)
推荐(0)
编辑
拆环成链+贪心区间覆盖+倍增
摘要: 好题,先插个眼,以后水平上来了再看 https://www.luogu.com.cn/problem/P4155 #include<bits/stdc++.h> #define endl '\n' #define lowbit(x) (x&-x) using namespace std; typed
阅读全文
posted @ 2024-11-12 20:22 TaopiTTT
阅读(5)
评论(0)
推荐(0)
编辑
链式并查集合并(裸板)
摘要: 对于操作:将一段元素合并为同类。 在合并
[
l
,
r
]
这一段数的时候,其实有很多数本来就在一个并查集里。我们只需要合并若干个还没有合并的并查集,而不需要从
l
到
r
一个一个合并。因为只要合并了这几个并查集,效果等价于把
[
l
,
r
]
直接合并了。 实现方法:每次记录
阅读全文
posted @ 2024-11-06 18:51 TaopiTTT
阅读(29)
评论(0)
推荐(0)
编辑
链式并查集合并+维护区间和
摘要: 用于解决区间合并查询问题 https://ac.nowcoder.com/acm/contest/93847/E #include<bits/stdc++.h> #define endl '\n' #define int long long #define lowbit(x) (x&-x) usin
阅读全文
posted @ 2024-11-04 20:15 TaopiTTT
阅读(5)
评论(0)
推荐(0)
编辑
bitset使用样例
摘要: bitset可将01字符串转换为01数组,快速进行位运算等操作 bitset<int>(string) //将01字符串转换为01数组 例题 https://ac.nowcoder.com/acm/contest/92972/D #include<bits/stdc++.h> #define end
阅读全文
posted @ 2024-10-28 21:03 TaopiTTT
阅读(9)
评论(0)
推荐(0)
编辑
Tarjan模板
摘要: 模板题在此 https://ac.nowcoder.com/acm/contest/86639/B /* tarjan:求强联通分量,本题中运用该算法实现重新构图并toposort */ #include<bits/stdc++.h> #define IOS ios::sync_with_stdio
阅读全文
posted @ 2024-10-28 16:10 TaopiTTT
阅读(5)
评论(0)
推荐(0)
编辑
下一页
导航
博客园
首页
联系
订阅
管理
<
2025年3月
>
日
一
二
三
四
五
六
23
24
25
26
27
28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
公告
昵称:
TaopiTTT
园龄:
10个月
粉丝:
5
关注:
2
+加关注
统计
随笔 - 31
文章 - 0
评论 - 0
阅读 -
338
搜索
常用链接
我的随笔
我的评论
我的参与
最新评论
我的标签
合集
有意思的题目(7)
随笔分类
模板(6)
一些题目(7)
随笔档案
2025年2月(1)
2024年11月(7)
2024年10月(10)
2024年9月(6)
2024年6月(7)
阅读排行榜
1. CF1971F Circle Perimeter(51)
2. 三维前缀和(31)
3. 链式并查集合并(裸板)(29)
4. 树状数组求区间最大小值(24)
5. 质因数分解+状态压缩求完全平方数(18)
点击右上角即可分享