Balanced Lineup ST表的裸题 ST采用倍增和动态规划的思想解决 RMQ问题 初始化:空间复杂度O(nlogn),时间复杂度O(nlogn) 查询一次 O(1);而且这是常数非常小的O(1),而不是像线段树这种毒瘤数据结构(常数非常大) 最近做一道题,ST表和线段树如果算时间复杂度都能 ...
分类:
其他好文 时间:
2018-08-23 23:10:15
阅读次数:
180
108. Convert Sorted Array to balanced Binary Search Tree The tricky part is the base case . Write induction part first and then test arrays of differe... ...
分类:
其他好文 时间:
2018-08-17 00:33:49
阅读次数:
150
平衡二叉树(Balanced Binary Tree?或?Height Balanced Tree)又称AVL树 (a)和(b)都是排序二叉树,但是查找(b)的93节点就需要查找6次,查找(a)的93节点就需要查找3次,所以(b)的效率不高。 平衡二叉树(Balanced Binary Tree 或 ...
分类:
其他好文 时间:
2018-08-14 22:01:28
阅读次数:
163
"1002 /hdu6299 Balanced Sequence" 题意: 给出 n 个括号串,要把这 n 个串任意排序连接成一个串,求最后连接成的串中,最长匹配子序列。 题解: 所有 n 个串中,本身能匹配的就先匹配掉,最后剩下三种串, "(((" 、 ")))((((" 、 ")))))" 。给 ...
分类:
其他好文 时间:
2018-08-12 21:41:06
阅读次数:
170
原文链接: Black Hat Arsenal USA 2018?—?The w0w lineup After the "huge success of Black Hat Arsenal USA 2017" , "@toolswatch" has now announced the list of ...
分类:
其他好文 时间:
2018-08-09 20:02:28
阅读次数:
205
题目链接 题意: 给定 n 个括号序列,问任意组合之后最大的匹配长度是多少。 思路: 要使得匹配长度最大,那么就是尽可能多的匹配括号,那么我们就可以记录每一个序列本身不能够匹配的左括号数和右括号数; 然后对于两个序列之间,我们分情况讨论,然后排序一遍,再进行匹配一次,记录答案就好了,详情见代码注释。 ...
分类:
其他好文 时间:
2018-08-07 10:19:28
阅读次数:
159
inputstandard input outputstandard output You are given a string s consisting only of characters 0 and 1. A substring [l,?r] of s is a string slsl?+?1 ...
分类:
其他好文 时间:
2018-08-05 01:11:12
阅读次数:
142
PS:先拿两个试一下,找到了。。。错误的排序方式,于是百度了两种做法。 (1)按照一个串的贡献进行排序,每次优先处理两个贡献大的串,然后用优先队列动态的对每次剩下的串排序。 //#include<bits/stdc++.h> #include<cstdio> #include<cstring> #i ...
分类:
其他好文 时间:
2018-07-26 21:08:12
阅读次数:
176
题意: t组测试数据,每组数据有 n 个只由 '(' 和 ')' 构成的括号串。 要求把这 n 个串排序然后组成一个大的括号串,使得能够匹配的括号数最多。 如()()答案能够匹配的括号数是 4,(()) 也是 4。 例如: n = 2 ) )(( 你可以将其排序为))((,数目为0,也可以将其排序为 ...
分类:
其他好文 时间:
2018-07-26 15:05:08
阅读次数:
97
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 using namesp... ...
分类:
其他好文 时间:
2018-07-26 00:00:13
阅读次数:
290