A - D-query Given a sequence of n numbers a1, a2, ..., an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For each d-query (i, ...
分类:
其他好文 时间:
2019-04-08 00:54:37
阅读次数:
129
题目: 1.binary tree preorder traversal 2.maximum depth of binary tree 3.balanced binary tree 4.binary tree maximum path sum 5.lowest common ancestor 6.b ...
分类:
其他好文 时间:
2019-04-06 19:05:08
阅读次数:
101
题面传送门 题意:给出两个$n=250000$的字符串,求最长公共子串。 思路:把第一个字符串放到SAM里面去。 对于第二个串,能匹配则匹配,不能匹配就跳回能匹配的位置,如果一个都不能匹配,则cur要重新初始化为root。 对后缀自动机的理解还比较模糊,怕误人子弟,此题就不做详述。 ...
分类:
其他好文 时间:
2019-04-06 14:13:07
阅读次数:
128
正解:SA 解题报告: 传送门! 啊先给个翻译趴QwQ大概就是说给个字符串,求互不相等的子串的个数 算是道小水题辣趴,,,并不难想到的呢QAQ只是因为是新知识所以巩固下而已QAQ 然后就显然考虑合法方案就会是所有方案-不合法方案 所有方案显然是n*(n+1)/2,不合法方案就是相等的子串的个数 考虑 ...
分类:
其他好文 时间:
2019-04-05 09:16:13
阅读次数:
163
【CF1133E】K Balanced Teams(动态规划,单调队列) 题面 "CF" 让你把一堆数选一些出来分成不超过$K$组,每一组里面的最大值和最小值之差不超过$5$,求最多有多少个人元素可以被分组。 题解 设$f[i][j]$表示把前$i$个数分成$j$组的最多人数。 然后单调队列转移一下 ...
分类:
其他好文 时间:
2019-04-04 17:28:26
阅读次数:
216
Given a balanced parentheses string , compute the score of the string based on the following rule: has score 1 has score , where A and B are balanced ...
分类:
其他好文 时间:
2019-04-01 01:02:23
阅读次数:
146
题目如下: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tre ...
分类:
其他好文 时间:
2019-03-30 10:34:52
阅读次数:
158
题目如下: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balance ...
分类:
其他好文 时间:
2019-03-30 10:34:39
阅读次数:
115
Problem "SPOJ NORMA2" & "bzoj3745" 题意概要:给定一个正整数序列 $\{a_i\}$,求 $$\sum_{i=1}^n\sum_{j=i}^n(j i+1)\min(a_i,a_{i+1},\cdots,a_j)\max(a_i,a_{i+1},\cdots a_j ...
分类:
其他好文 时间:
2019-03-29 23:43:48
阅读次数:
151
```cpp / 求right集合大小 然后后缀最大值 / include include include include include define ll long long define M 600010 define mmp make_pair using namespace std; in ...
分类:
其他好文 时间:
2019-03-28 09:57:30
阅读次数:
178