这道题想了很久,总觉得状态太多,情况太多,用dp根本不知道该怎么写
看了网上的解题报告,说是用状压dp,即dp[i]记录完成哪几个作业所扣分的最小值,然后递推公式是:dp[i]=min(dp[i],max(dp[i-(1
sum[i]即到该状态时已经花费的时间,cost[j]表示第j个作业需要花费的赶时间,dead[j]表示第j个作业的deadline
由于考虑第i个状态的时候,i状态可以由...
分类:
其他好文 时间:
2015-04-25 15:12:38
阅读次数:
107
Recently, researchers on Mars have discovered N powerful atoms. All of them are different. These atoms have some properties. When two of these atoms collide, one of them disappears and a lot of power i...
分类:
其他好文 时间:
2015-04-24 19:14:37
阅读次数:
116
div2的F题,只想到了一个复杂度略高的dp,T了几次,后来加了剪枝减掉一些无用的状态终于过了。。题意:一个n*m的矩阵 (n 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using name...
分类:
其他好文 时间:
2015-04-24 12:24:48
阅读次数:
147
Description
Recently, researchers on Mars have discovered N powerful atoms. All of them are different. These atoms have some properties. When two of these atoms collide, one of them disappears and ...
分类:
其他好文 时间:
2015-04-19 06:33:12
阅读次数:
115
Chess
Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)
Submit Statistic Next
Problem
Problem Description
Xiang-qi is a kind of traditional Chinese chess. ...
分类:
其他好文 时间:
2015-04-16 19:59:15
阅读次数:
140
题目大意:给定一张无向图,求这张无向图的生成子图中有多少强连通图
正着做不好做,我们考虑容斥原理
如果一个图不连通,那么这张图缩点之后一定会形成一个点数>=2的DAG
一个DAG中一定会有一些入度为0的点,我们枚举这些点的点集进行容斥
具体DP方程和细节见代码 注释写的还是比较详细的我就不多说了= =
#include
#include
#include
#include
#de...
分类:
其他好文 时间:
2015-04-15 14:51:26
阅读次数:
402
// hdu 3001 TSP问题的变形
// 这次到每个点最多两次,所以可以用三进制的类推
// dp[S][u]表示当前在u点访问状态为S时所得到的最小的开销
// 采用刷表法,即用当前的状态推出它所能转移的状态
// dp[S][u] 可以到达的状态为dp[S+state[v]][v](dist[u][v]!=inf)
// dp[S+state[v]][v] = max(dp[S+stat...
分类:
其他好文 时间:
2015-04-15 01:03:10
阅读次数:
148
首先预处理出来前K个点互相之间的最短路,直接Dijkstra就好了然后就变成了状压DP。。。随便写一下好了 1 /************************************************************** 2 Problem: 1097 3 U...
分类:
其他好文 时间:
2015-04-15 00:44:14
阅读次数:
121
// poj3254 状压dp入门
// dp[i][S]表示前i行第i行状态为S时放牧的情况
// S为十进制的二进制数形式如5为101表示第一列和第三列放牧的方法数
// 首先dp[0][S]合法的话就是1
// 状态转移方程为dp[i][S] = sigma(dp[i-1][V])(S与V是合法状态)
// 最后的结果就是dp[n][S](S为所有的合法状态)
//
// 刚开始十分傻x的...
分类:
其他好文 时间:
2015-04-14 21:41:16
阅读次数:
131
Frank is a portfolio manager of a closed-end fund for Advanced Commercial Markets (ACM ). Fund collects money (cash) from individual investors for a certain period of time and invests cash into variou...
分类:
其他好文 时间:
2015-04-13 23:05:36
阅读次数:
363