由于食物的分配顺序是确定的,所以可以以前面i个食物作为阶段划分。而只有每个煤矿的最后两个食物的类型会对后面造成影响,因此可以用状态f[i,j,k,l,m]表示分配到第i个食物时,第一个煤矿最后两个食物依次是j和k,第二个煤矿最后两个食物依次是l和m时的总最大产量。
状态转移方程:
放在第一个煤矿:f[i+1,k,food[i+1],l,m]:=max(f[i+1,k,food[i+1],l,m],f[i,j,k,l,m]+dif(j,k,food[i+1]));
放在第二个煤矿:f[i+1,j,k,m,food[i+1]]:=max(f[i+1,j,k,m,food[i+1]],f[i,j,k,l,m]+dif(l,m,food[i+1]));
由于f[i+1]只与f[i]有关,所以可以用滚动数组将空间复杂度降到O(2*4^4)。
R1141347 Accepted 100 From IwfWcf- P1386 FPC Vivid Puppy 2009-2-10 16:47:16
hermes birkin, http://www.hermesbirkin.org/
回复删除chanel outlet, http://www.chaneloutletstore.us.com/
nike free uk, http://www.nikefreerunning.org.uk/
ray ban sunglasses, http://www.raybansunglass.com.au/
rolex watches, http://www.rolexwatches.in.net/
ray ban sunglasses, http://www.ray-bansunglasses.eu.com/
yoga pants, http://www.yogapants.us.com/
beats headphones, http://www.beats-headphones.in.net/
michael kors outlet, http://www.michaelkorsusa.us/
pandora jewelry, http://www.pandora.eu.com/
cheap ugg boots, http://www.cheapuggboots.net.co/
air jordan shoes, http://www.airjordanshoes.us.org/
louis vuitton outlet, http://www.louisvuittonus.us.com/
ed hardy clothing, http://www.edhardy.us.com/
replica handbags, http://www.replicahandbag.us.com/
the north face outlet store, http://www.thenorthfaceoutletstores.org/
tiffany jewellery, http://www.tiffanyjewelleryoutlets.co.uk/
lebron james shoes, http://www.lebronjamesshoes.in.net/
gucci handbags, http://www.guccihandbags-outlet.co.uk/
true religion outlet, http://www.truereligionoutletstore.us.com/
swarovski jewelry, http://www.swarovski.in.net/
michael kors outlet, http://michaelkors.outletonlinestores.us.com/
swarovski outlet, http://www.swarovski-outlet.co.uk/
wedding dresses, http://www.weddingdressesoutlet.co.uk/
louis vuitton handbags, http://www.louisvuittonhandbagsoutlet.co.uk/
lebron james shoes, http://www.lebronjames.us.com/
nike trainers, http://www.niketrainers.me.uk/
kobe shoes, http://www.kobeshoes.us/
cheap snapbacks, http://www.cheapsnapbacks.us.com/
1003maoqiuyun
hermes online
回复删除supreme
coach handbags
golden goose
kevin durant shoes
kd shoes
vapormax
Kanye West shoes
off white hoodie
yeezy
gucci replica c90 g2y51p3r14 replica bags online o84 m5i68z8s09 replica designer bags z38 q9d76d9y49
回复删除