题目描述
思路
第一问很简单,最长下降子序列问题,第二问的统计方案数有点意思。
阅读全文问题:题目地址
Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:
Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code $a_i$ is known (the code of the city in which they are going to).
★★☆
输入文件:zootopia.in 输出文件:zootopia.out 简单对比
时间限制:1 s 内存限制:32 MB
你需要帮他制定一个使多层蛋糕总体积最大的方案。
你只需要计算出最大的总体积即可。 注意:两个半径相同的蛋糕不能放在一起
第一行一个整数n,
接下来n行,第i+1行两个整数R,H分别表示编号为i的蛋糕的半径和高度。
只有一行一个整数,为最大总体积,由于出题人懒得写评测插件,你需要精确到小数点后2位
此题乍一看是普通的最长上升/下降子序列,然而$O(n^2)$的做法会挂掉,所以要用$O(nlogn)$的做法
阅读全文