上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 31 下一页
摘要: 可持久化权值线段树 #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #include <cmath> #include <cstring> #include <vector> #define 阅读全文
posted @ 2024-03-13 16:37 Gold_stein 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 可持久化字典树 #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #include <cmath> #define For(i, j, n) for(int i = j ; i <= n ; + 阅读全文
posted @ 2024-03-11 21:25 Gold_stein 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 这道题出得很妙。 首先,对原数组求前缀和,然后我们能够发现,对ai进行操作就相当于交换(s[i],s[i-1]),然后就把原问题转化成维护一个先下凸,后上凸的双峰函数。 #include <iostream> #include <stdio.h> #include <algorithm> #incl 阅读全文
posted @ 2024-03-11 10:46 Gold_stein 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 这题没想到怎么贪心,看题解恍然大明白 #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #define For(i, j, n) for(int i = j ; i <= n ; ++i) us 阅读全文
posted @ 2024-03-09 20:58 Gold_stein 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 实际上这道题不需要先排序再求gcd,因为无论是哪两项之前作差,都不会影响最后的gcd的结果。 因为公差是从a2-a1开始算的,因此i=1时要特殊处理,不能把a1-0计入贡献,否则会算出错误的gcd。 即作差时不要加上a1-0,统计最值时不要漏掉a1 #include <iostream> #incl 阅读全文
posted @ 2024-03-09 20:43 Gold_stein 阅读(29) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #define For(i, j, n) for(int i = j ; i <= n ; ++i) using namespace std; 阅读全文
posted @ 2024-03-07 08:52 Gold_stein 阅读(5) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #define For(i, j, n) for(int i = j ; i <= n ; ++i) using namespace std; 阅读全文
posted @ 2024-03-05 15:33 Gold_stein 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 做这道题的时候混淆了满二叉树和完全二叉树的概念: 满二叉树:顾名思义,就是塞满了 完全二叉树:除了最后一层之外,每一层都必须是满的,且最后一层如果不满,则所有节点都尽可能靠左。 #include <iostream> #include <stdio.h> #include <algorithm> # 阅读全文
posted @ 2024-03-04 12:17 Gold_stein 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> using namespace std; const int N = 100010; int n; stru 阅读全文
posted @ 2024-03-04 11:17 Gold_stein 阅读(4) 评论(0) 推荐(0) 编辑
摘要: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; typedef long long LL; const int N = 500010; int n, 阅读全文
posted @ 2024-03-04 10:53 Gold_stein 阅读(7) 评论(0) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 31 下一页