100722E The Bookcase】的更多相关文章

传送门 题目大意 给你一些书的高度和宽度,有一个一列三行书柜,要求放进去书后,三行书柜的高的和乘以书柜的宽度最小.问这个值最小是多少. 分析 我们可以先将所有书按照高度降序排好,这样对于每一层只要放过书高度边不会改变.我们设第一本书放在第一层,用dp[i][j][k]表示考虑到第i个,第二层的厚度为j,第三层的厚度为k的情况时书架的最小总高度是多少,如果j或k是0则代表这一层以前没放过书,然后根据这个转移就行了.由于空间不够我们使用滚动数组.注意由于至少有三本书,所以每一层至少会放一个(这样可以…
题目链接:D Persistent Bookcase 题意:有一个n*m的书架,开始是空的,现在有k种操作: 1 x y 这个位置如果没书,放书. 2 x y 这个位置如果有书,拿走. 3 x 反转这一行,即有书的位置拿走,没书的位置放上书. 4 x 返回到第x步操作之后的书架. 现在给出q个操作,询问每次操作之后书架上书的数量. 思路: 开始没有思路.后来被告知dfs. [词不达意.参考:http://blog.csdn.net/zyjhtutu/article/details/5227949…
D. Persistent Bookcase Recently in school Alina has learned what are the persistent data structures: they are data structures that always preserves the previous version of itself and access to it when it is modified. After reaching home Alina decided…
Persistent Bookcase Problem Description: Recently in school Alina has learned what are the persistent data structures: they are data structures that always preserves the previous version of itself and access to it when it is modified. After reaching…
UVa 12099  The Bookcase 题目: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=42067 思路:   将n本书分配到三层,使得形成的书架w*h最小 提前将书籍按照高度排序,因为无论第一本书(最高的书)无论放在那一层都会被考虑到,所以规定将它放在第一层,且第二层比第三层高. 因为从大到小排序的关系,只要jk==0那么新加入的书i就是该层的高度,否则高度不变. 设d[i][j][k]表示考虑过i本书第二…
Persistent Bookcase time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Recently in school Alina has learned what are the persistent data structures: they are data structures that always prese…
What is Susan's favourite color ? A:You're working hard, Georage. What are you doing? B:I am making a bookcase. Give me that hammer please, Dan. A:Which hammer? This one? B:No, not that one. The big one. A:Here you are. B:Thanks, Dan. A:What are you…
D. Persistent Bookcase 题目连接: http://www.codeforces.com/contest/707/problem/D Description Recently in school Alina has learned what are the persistent data structures: they are data structures that always preserves the previous version of itself and a…
Description Recently in school Alina has learned what are the persistent data structures: they are data structures that always preserves the previous version of itself and access to it when it is modified. After reaching home Alina decided to invent…
题目链接: D. Persistent Bookcase time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Recently in school Alina has learned what are the persistent data structures: they are data structures that alw…