Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. Given a singly linked list where element ...
分类:
其他好文 时间:
2019-06-03 23:35:02
阅读次数:
108
The 13th Chinese Northeast Collegiate Programming Contest B. Balanced Diet G. Radar Scanner H. Skyscraper J. Time Limit 2018-2019 ACM-ICPC, China Mult ...
分类:
其他好文 时间:
2019-05-30 21:57:43
阅读次数:
230
After the success of 2nd anniversary (take a look at problem FTOUR for more details), this 3rd year, Travel Agent SPOJ goes on with another discount t ...
分类:
其他好文 时间:
2019-05-26 17:48:20
阅读次数:
82
Lexicographical Substrings Search $$ Time Limit: 149 ms \quad Memory Limit: 1572864 kB $$ 题意 给出一个字符串,求出这个字符串上字典序第 $k$ 小的子串。 思路 先对给出的字符串构建后缀自动机,因为后缀自动机 ...
分类:
其他好文 时间:
2019-05-22 19:13:27
阅读次数:
77
Lexicographical Substrings Search $$ Time Limit: 149 ms \quad Memory Limit: 1572864 kB $$ 题意 给出一个字符串,求出这个字符串上字典序第 $k$ 小的子串。 思路 对于给出的字符串,求出后缀数组,根据后缀数组的 ...
分类:
编程语言 时间:
2019-05-22 19:09:47
阅读次数:
98
SPOJ卡常也太可怕了吧……$O((\frac{n+m}{32})^3)$卡100ms,这都什么人啊.jpg 关于这题,设格子$(x,y)$上原来的数为$a[x][y]$,对格子操作为$f[x][y]$ 则有 $\oplus_{i=1}^n f[i][y]\; xor \;\oplus_{i=1}^ ...
分类:
其他好文 时间:
2019-05-08 14:36:49
阅读次数:
128
[SPOJ COT]Count on a tree 题面 You are given a tree with N nodes. The tree nodes are numbered from 1 to N . Each node has an integer weight. We will ask ...
分类:
其他好文 时间:
2019-05-07 16:59:52
阅读次数:
205
[SPOJ DQUERY]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 ...
分类:
其他好文 时间:
2019-05-06 16:09:53
阅读次数:
143
解法1:后缀自动机 解法1.1用串1建后缀自动机,用串2匹配。并记录能匹配的长度。匹配成功+1,否则变为maxlen[最后fail到的位置]+1。 解法1.2串一先加,然后加入'#‘。再加串2.加串2的时候,如果新得到的节点的slink在一串,则说明出现了2次。 解法1.3.建立广义后缀自动机,用数 ...
分类:
其他好文 时间:
2019-05-03 16:06:40
阅读次数:
119
题目链接:https://codeforces.com/contest/1133/problem/C 题意: 给出 $n$ 个数,选取其中若干个数分别组成 $k$ 组,要求每组内最大值与最小值的差值不超过5,求 $k$ 组合起来最多可以放多少个数。 题解: 将 $a[1 \sim n]$ 从小到大排 ...
分类:
其他好文 时间:
2019-05-03 11:56:20
阅读次数:
142