摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2648思路:map映射,记录一下memory的位置即可。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 int Point[10010]; 9 10 int main() {11 int n,m,pos,price;12 while(~scanf("%d",&n)) {13 memset(Point,0,sizeof(Point));1. 阅读全文
posted @ 2013-05-28 22:13 ihge2k 阅读(431) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3873思路:题目意思很简单,就是说如果没有攻占保护x的城市,就不能攻占,我们可以用pro[x]记录保护x的所有城市被攻占的最早时间,那么能到x的最短时间为pro[x]和到达x的最短路中的较大者 .dij入队过程中只把In[x](没有被包含的城市)入队 对于出队的x,它的最短时间已经确定,表示已经被占领,它所保护的城市的保护度减1,一旦某个被保护的城市的保护度为零且已经到底(未占领,d[x]!=inf),就可以确定到达它的 最短时间(为max(pro[x],dist[x])),它也就到了入队的时机。 阅读全文
posted @ 2013-05-28 13:26 ihge2k 阅读(874) 评论(0) 推荐(0) 编辑