上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 54 下一页
  2023年3月2日
摘要: 求树上每个点的 最远点的距离 Di 换根dp #include <iostream> #include <vector> #include <algorithm> #include <cstring> using namespace std ; const int N=1e5,M=N; int nx 阅读全文
posted @ 2023-03-02 01:29 towboat 阅读(9) 评论(0) 推荐(0)
摘要: 消除方块,同色可以消除,产生价值 (len)^2 求最后最大的价值 区间dp #include <iostream> #include<queue> #include <cstring> #define IOS std::ios::sync_with_stdio(0) using namespace 阅读全文
posted @ 2023-03-02 01:15 towboat 阅读(11) 评论(0) 推荐(0)
  2023年2月27日
摘要: 给一些区间,挑出最少的区间覆盖 【0,L】 贪心:从0往后,每次挑出R 点最大的 #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std ; const int 阅读全文
posted @ 2023-02-27 18:26 towboat 阅读(34) 评论(0) 推荐(0)
摘要: 给定n种硬币,其中第 i种硬币的面值为 Ai,共有p iCi 个。 从中选出若干个硬币,把面值相加,若结果为sS ,则称“面值sS 能被拼成”。 求 1∼M 1~M之间能被拼成的面值有多少个。 #include <iostream> #include <cstring> using namespac 阅读全文
posted @ 2023-02-27 15:23 towboat 阅读(24) 评论(0) 推荐(0)
摘要: 除了源点之外,树中所有度数为1 的节点都是入海口,可以吸收无限多的水,我们称之为汇点。 也就是说,水系中的水从源点出发,沿着每条河道,最终流向各个汇点。 问最大流量 f[ x] = sum{ min( f[y] ,z) } 换根,考虑 g[x] 流向所有(包括x往上) 时的最大流量 g[y]=f[y 阅读全文
posted @ 2023-02-27 00:06 towboat 阅读(20) 评论(0) 推荐(0)
  2023年2月26日
摘要: 求两段不相交子序列,他们异或和的 和最大 #include<iostream> #include <algorithm> #include <cstring> using namespace std; const int N =4e5+4; int ch[N*32][2],ans; int tot= 阅读全文
posted @ 2023-02-26 20:56 towboat 阅读(37) 评论(0) 推荐(0)
摘要: 从序列A中选出两个进行异或运算,得到的结果最大是多少? 两个数二进制插入Trie 每次遍历时尽量走反 #include<iostream> #include <algorithm> #include <cstring> using namespace std; const int N =1e5+4; 阅读全文
posted @ 2023-02-26 20:37 towboat 阅读(14) 评论(0) 推荐(0)
摘要: 给一些串,问每个串的唯一前缀,若不存在输出本身 #include<iostream> #include <cstring> #include <algorithm> using namespace std ; const int N =1e5; int ch[N][30],tot,val[N]; v 阅读全文
posted @ 2023-02-26 19:55 towboat 阅读(11) 评论(0) 推荐(0)
摘要: 给一些字符串 , 问 是否有两个串有前缀关系 字典树节点维护结束标记 val[ ] , 跑的时候检查一下 #include<iostream> #include <algorithm> #include <cstring> using namespace std; const int N=1e5+4 阅读全文
posted @ 2023-02-26 17:36 towboat 阅读(172) 评论(0) 推荐(0)
摘要: 现在有个字典要支持一下操作 1、insert : 往神奇字典中插入一个单词 2、delete: 在神奇字典中删除所有前缀等于给定字符串的单词 3、search: 查询是否在神奇字典中有一个字符串的前缀等于给定的字符串 字典树每个节点维护 sum[ i ] delete 操作: 先查询包含该串的串个数 阅读全文
posted @ 2023-02-26 17:25 towboat 阅读(23) 评论(0) 推荐(0)
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 54 下一页