Divisibility Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11001   Accepted: 3933 Description Consider an arbitrary sequence of integers. One can place + or - operators between integers in the sequence, thus deriving different arithmet…
题目大意:在一个平面内有若干个点,要求用一些矩形覆盖它们,一个矩形至少覆盖两个点,可以相互重叠,求矩形最小总面积. 分析: 数据很小,很容易想到状压DP,我们把点是否被覆盖用0,1表示然后放在一起得到一个最多15位的二进制数字作为状态,对于每种状态枚举矩形,进行覆盖. 要进行一个预处理,将每种矩形多覆盖的点状态保存下来,并计算面积,然后就是DP了. 状态转移方程f[s2]=min(f[s2],f[s1]+area) s1为原来状态,s2表示后来放置矩形后的状态. 因为可以重复覆盖,计算s2不是s…
题意:略. 思路:这一题开始做的时候完全没有思路,便去看了别人的题解. 首先,对于这个题目解法想有一个初步的了解,请看这里:http://www.2cto.com/kf/201208/146894.html 根据这篇讲解,写了一篇扭曲的代码,提交之后TLE. 经过排查分析之后发现,算法的复杂度为O(hw*(2^(2w))),这个复杂度肯定超了.后来进行了优化,如果两种状态可以匹配,就将它们用邻接表(vector实现)存储起来,这样只需一遍预处理,以后直接读取就可以了. 此外,还有两个地方的优化:…
Divisibility Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 10598   Accepted: 3787 Description Consider an arbitrary sequence of integers. One can place + or - operators between integers in the sequence, thus deriving different arithmet…
题意:给出n,k,n个数,在这n个数之间任意放置+,-号,称得到的等式的值能够整除k则为可划分的,否则为不可划分的. 自己想的是枚举,将所有得到的等式的和算出来,再判断它是否能够整除k,可是有10000个数-_- 5555---还是看的题解-- 话说这样的状态好奇妙啊啊啊--- 用dp[i][j]表示等式中有i个数的时候余数为j是否成立,成立的话dp[i][j]的值为1,否则为0 然后就是递推的过程, 如果dp[i-1][j]为1,那么dp[i][(j-a[i])%k]=1,dp[i][(j+a…
POJ:http://poj.org/problem?id=1745 A完这题去买福鼎肉片,和舍友去买滴~舍友感慨"这一天可以卖好几百份,每份就算赚一块钱..那么一个月..一年..." 我说"那我们以后去卖这个吧,饿了还能自己煮着吃" 哈哈,一群天真的少年呀~~~~ 说正事~ ------------------------------------------------华丽的分割线------------------------------------------…
The Fortified Forest Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6115   Accepted: 1720 Description Once upon a time, in a faraway land, there lived a king. This king owned a small collection of rare and valuable trees, which had been…
Divisibility Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9476   Accepted: 3300 Description Consider an arbitrary sequence of integers. One can place + or - operators between integers in the sequence, thus deriving different arithmeti…
Description Farmer Johnson's Bulls love playing basketball very much. But none of them would like to play basketball with the other bulls because they believe that the others are all very weak. Farmer Johnson has N cows (we number the cows from 1 to…
Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings and height in varying ways. Expert as he was in this material, he saw at a glance that he'll need a computer to calculate t…