上一页 1 2 3 4 5 6 7 ··· 12 下一页
摘要: 题目描述 这是一道模板题。 读入一个由小写英文字母组成的字符串 ss ,请把这个字符串分成若干部分 s=s_1s_2s_3\cdots s_ms=s1​s2​s3​⋯sm​,使得每个 s_isi​ 都是 \text{Lyndon Word}Lyndon Word,且 \forall 1\le i<m 阅读全文
posted @ 2020-07-29 19:56 N_Yokel 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题意:给出一个完全图,求删除K边后,最长的最短路径。 题解:删除的边肯定要在最短路径上删除,删除一条边后,跑一次最短路径,在从最短路径上暴力选择一个删除,直到删了K条边。注意ans要初始化,还有就是最短路径数组是二维的,开滚动数组在dfs的过程中被迭代掉。 #include <bits/stdc++ 阅读全文
posted @ 2020-07-29 18:22 N_Yokel 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 链接:https://ac.nowcoder.com/acm/contest/5671/K 题目描述 A sequence is called kkk-bag, if and only if it is put in order by some (maybe one) permutations of 阅读全文
posted @ 2020-07-29 14:30 N_Yokel 阅读(250) 评论(0) 推荐(0) 编辑
摘要: Problem Description Our protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemies who 阅读全文
posted @ 2020-06-14 16:28 N_Yokel 阅读(127) 评论(0) 推荐(0) 编辑
摘要: Description A rooted tree is a well-known data structure in computer science and engineering. An example is shown below:In the figure, each node is la 阅读全文
posted @ 2020-06-14 10:24 N_Yokel 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目描述 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作: 插入 xx 数 删除 xx 数(若有多个相同的数,因只删除一个) 查询 xx 数的排名(排名定义为比当前数小的数的个数 +1+1 ) 查询排名为 xx 的数 求 xx 的前驱(前驱定义为小于 xx,且最大的数) 阅读全文
posted @ 2020-06-10 10:38 N_Yokel 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 题意: 题解:同Gym102222G(链接),把size数组更改一下即可。 #include <bits/stdc++.h> using namespace std; const int maxn=1e5+5; const long long inf=1e17+5; int n, m, k; int 阅读全文
posted @ 2019-11-28 11:38 N_Yokel 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 链接:https://codeforces.com/gym/102222/problem/G 题意:给出一个树,从所有的叶子节点中选出m个节点,使得这m个节点间的 sigma(任意2点间的距离)最小。求最小的sigma。 n<1e5, k<100。 题解:求任意2点间的距离和, 可考虑贡献,考虑每条 阅读全文
posted @ 2019-11-28 11:31 N_Yokel 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 链接:http://codeforces.com/contest/1221/problem/E 题意:给出有.x组成的字符串,两个人博弈,一个人每次可以选择一段连续长度为a的.使得它变成x,另一个选择长度为b的进行操作,为谁会输,保证a>b 题解: #include <bits/stdc++.h> 阅读全文
posted @ 2019-11-19 18:19 N_Yokel 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 链接:http://codeforces.com/contest/1221/problem/D 题意:长度为n的序列,要使得相邻的值都不相同,可对每一个值多次加1,每次的加1的cost为cost【i】,求使得满足条件的最小代价。 题解:分类讨论可以发现,对于每一个值来说,最多也就会加2,即对前i个最 阅读全文
posted @ 2019-11-19 18:02 N_Yokel 阅读(104) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 12 下一页