题目 题目链接:https://codeforces.com/contest/1039/problem/D 有一棵 \(n\) 个节点的树。其中一个简单路径的集合被称为 \(k\) 合法当且仅当树的每个节点至多属于其中一条路径,且每条路径恰好包含 \(k\) 个点。 对于 \(k\in [1,n]\ ...
转载
2021-07-26 09:30:00
179阅读
2评论
You Are Given a Tree 感觉是个套路。。 怎么好像我没怎么见过啊。 k * t <= n 类似于这种, 对所有 k 求满足条件 t 的最大值, 那么答案不同的数量只有根号个。 如果随 k 的变化单调的话就可以二分优化啦。
转载
2019-06-06 19:54:00
111阅读
2评论
正题 题目链接:https://www.luogu.com.cn/problem/CF1039D 题目大意 给出$n$个点的一棵树,然后对于$k\in[1,n]$求每次使用一条长度为$k$的链覆盖树并且不能重复覆盖点时最大覆盖条数。 \(1\leq n\leq 10^5\) 解题思路 先考虑暴力怎么 ...
转载
2021-09-27 16:53:00
101阅读
2评论
B. You Are Given a Decimal String...这个题需要求出从某一个尾数 n 变为 m 所需要的 x 和 y 的最小个数(i+j) 那么就需要预处理出一个数组来存放这个值。数组 b[ ] 中存的是所需要多添加的数的个数 (i+j-1)int b[10];for (int i = 0; i < 10; ++i) b[i] = inf;for (int i =
原创
2022-11-03 15:22:47
10000+阅读
如果 $k$ 值确定的话,我们直接来一个 $O(n)$ 的贪心就行. 那么我们就将 $k$ 分为大于 $B$ 和小于 $B$ 两部分处理. 对于小于 $B$ 的部分,暴力处理,复杂度为 $O(nB)$. 对于大于 $B$ 的部分,取值分别为 $[0,\frac{n}{B}]$ 且依次递减. 那么我们
转载
2021-07-07 10:04:26
42阅读
原创
2022-11-03 15:22:10
23阅读
You're given a string of lower-case Latin letters. Your task is to find the length of its longest substring that can be met in the string at least twi
转载
2017-12-03 18:49:00
170阅读
consist vi.由……组成;由……构成(常和介词of构成固定搭配)made up of由……组成[例如] One year consists of 365 days.一年有365天.The team consists of 10 members.这个小组由10个成员组成.Society is made up of people with different abilities.社会由能力不同
原创
2021-08-11 09:54:42
251阅读
1.why do we consist hashing? problem: if we just use the normal hashing, for example, firstly we have 3 nodes in our db system, all the hashcode%3==0 ...
转载
2021-08-17 08:40:00
162阅读
2评论
传送赛i发噶伤口处内塞分红i阿三发
原创
2022-02-11 16:12:52
24阅读
发这题写到最后才发现dp,floyd这题写到最后才发现dp,floyd这题写到最后才发现dp,floyd首先枚举x,y,对每种情况计算首先枚举
原创
2021-08-26 16:22:02
31阅读
给出一个字符串t和n个字符串 设f(t,s)为s在t中的出现次数。 求$sum_^n\sum_^nf(t,s_i+s_j)$ 枚举划分点。 对t的每个划分点x,处理出有多少个字符串是当前t[0,x]的后缀。 然后反着建AC自动机,反着枚举划分点x,处理出有多少个字符串是当前t[x,n]的后缀。 处理 ...
转载
2021-07-13 12:52:00
142阅读
2评论
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSuppose you have a specialx-y-counter. This counter can store some value as a ...
原创
2021-09-06 14:22:57
50阅读
http://www.geeksforgeeks.org/in-place-convert-a-given-binar
转载
2015-07-22 16:11:00
118阅读
2评论
By given a binary tree, and a root node, find the deepest node of this tree. We have way to create node: Way to create tree: Way to construct tree: Th
转载
2019-03-11 21:00:00
67阅读
2评论
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSuppose you have a specialx-y-counter. This counter can store some value as a ...
原创
2022-03-13 11:23:21
17阅读
public class Reverse { public static void main(String args[]) { StringBuilder array = new StringBuilder(); array.append("abcderr"); for(int i=0;i { char temp=array.charAt(i);
原创
2022-08-01 08:50:04
68阅读
The question and solution are from: http://www.geeksforgeeks.org/convert-given-binary-tree-doubly-linked-list-set-3/ Given a Binary Tree (BT), convert
转载
2016-11-11 07:54:00
174阅读
2评论
Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there
原创
2022-08-01 08:50:45
58阅读
题目地址 题目思路很明确,求t上每个位置以其结尾的串有多少个,以其为开头的串有多少个,然后遍历一遍算出贡献就行了。最后正解的思路非常简单,但我硬是整了几个假算法浪费时间,下面说一下我的心路历程。 第一层:求开头?求结尾?这不是弱智kmp吗?敲敲敲...一遍过样例,就这也有2400? 然后t了。仔细一 ...
转载
2021-11-03 14:59:00
153阅读
2评论