题面 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int N=550,M=1e6+60,mod=1e9+7; 6 int fac[M],inv[M],fth[N ...
分类:
其他好文 时间:
2019-02-26 21:04:48
阅读次数:
205
题意 "题目链接" Sol 这题可以动态dp做。 设$f[i]$表示以$i$为结尾的最大子段和,$g[i]$表示$1 i$的最大子段和 那么 $f[i] = max(f[i 1] + a[i], a[i])$ $g[i] = max(g[i 1], f[i])$ 发现只跟前一项有关,而且$g[i]从 ...
分类:
其他好文 时间:
2019-02-24 10:26:28
阅读次数:
175
题目: Given an array where elements are sorted in ascending order, convert it to a height balanced BST 解答: ...
分类:
其他好文 时间:
2019-02-22 16:44:55
阅读次数:
125
Highways 题目链接:https://vjudge.net/problem/SPOJ-HIGH Description: In some countries building highways takes a lot of time... Maybe that's because there ...
分类:
其他好文 时间:
2019-02-17 22:17:40
阅读次数:
206
Find The Determinant III 题目链接:https://vjudge.net/problem/SPOJ-DETER3 Description: Given a NxN matrix A, find the Determinant of A % P. Input: Multiple ...
分类:
其他好文 时间:
2019-02-17 22:09:42
阅读次数:
219
"93. Balanced Binary Tree" / "" 本题难度: Easy Topic: Binary Tree Description Given a binary tree, determine if it is height balanced. For this problem, a ...
分类:
其他好文 时间:
2019-02-14 20:37:15
阅读次数:
145
不连续的处理很麻烦 导致序列DP又找不到优秀的子问题 自底向上考虑? 建立小根堆笛卡尔树 每个点的意义是:高度是(自己-father)的横着的极大矩形 子问题具有递归的优秀性质 f[i][j]i为根子树,放j个 儿子背包合并 考虑本层的矩形放多少个 枚举一共放t个,本层放j个 对于子树里的放置的t- ...
分类:
其他好文 时间:
2019-02-14 20:17:52
阅读次数:
196
思路
既然是异或预算,很容易想到按位操作。
按位操作之后,每个点的权值就只有$0$和$1$两个了, ...
分类:
其他好文 时间:
2019-02-10 09:33:44
阅读次数:
172
"Glass Beads" Time Limit: 3000MS Memory Limit: 10000K Total Submissions: 5254 Accepted: 2943 Description Once upon a time there was a famous actress. ...
分类:
其他好文 时间:
2019-02-07 09:20:28
阅读次数:
131
算法描述: 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-02-03 11:05:02
阅读次数:
142