ZOJ 3905 Cake ZOJ Monthly, October 2015 - C】的更多相关文章

Cake Time Limit: 4 Seconds      Memory Limit: 65536 KB Alice and Bob like eating cake very much. One day, Alice and Bob went to a bakery and bought many cakes. Now we know that they have bought n cakes in the bakery. Both of them like delicious cakes…
Bob wants to pour water Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge There is a huge cubiod house with infinite height. And there are some spheres and some cuboids in the house. They do not intersect with others and the house.…
Prime Query Time Limit: 1 Second      Memory Limit: 196608 KB You are given a simple task. Given a sequence A[i] with N numbers. You have to perform Q operations on the given sequence. Here are the operations: A v l, add the value v to element with i…
Market Time Limit: 2 Seconds      Memory Limit: 65536 KB There's a fruit market in Byteland. The salesmen there only sell apples. There are n salesmen in the fruit market and the i-th salesman will sell at most wi apples. Every salesman has an immedi…
Number Game Time Limit: 2 Seconds      Memory Limit: 65536 KB The bored Bob is playing a number game. In the beginning, there are n numbers. For each turn, Bob will take out two numbers from the remaining numbers, and get the product of them. There i…
Ant Time Limit: 1 Second      Memory Limit: 32768 KB There is an ant named Alice. Alice likes going hiking very much. Today, she wants to climb a cuboid. The length of cuboid's longest edge is n, and the other edges are all positive integers. Alice's…
Prime Query Time Limit: 1 Second      Memory Limit: 196608 KB You are given a simple task. Given a sequence A[i] with N numbers. You have to perform Q operations on the given sequence. Here are the operations: A v l, add the value v to element with i…
动态规划题:dp[i][j]表示有i个Cake,给了Alice j个,先按照b排序,这样的话,能保证每次都能成功给Alice Cake,因为b从大到小排序,所以Alice选了j个之后,Bob最少选了j个,所以i>=2*j, 并且每次Alice选的时候Bob已经选过了.所以当i>=2 * j的时候Alice一定能选. 所以dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - 1] + ary[i].a); dp[i - 1][j]表示Alice不选第i个,dp[i…
Cake Time Limit: 4 Seconds      Memory Limit: 65536 KB Alice and Bob like eating cake very much. One day, Alice and Bob went to a bakery and bought many cakes. Now we know that they have bought n cakes in the bakery. Both of them like delicious cakes…
题目传送门 /* 题意:n个时刻点,m次时光穿梭,告诉的起点和终点,q次询问,每次询问t时刻t之前有多少时刻点是可以通过两种不同的路径到达 思维:对于当前p时间,从现在到未来穿越到过去的是有效的值,排个序,从大到小询问,那么之前添加的穿越点都是有效的, 用multiset保存.比赛时想到了排序,但是无法用线段树实现查询,stl大法好! */ #include <cstdio> #include <algorithm> #include <cstring> #includ…