poj 1949 Chores 最长路】的更多相关文章

题目链接 求出最长路..... #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <map> #include <set> #include <string> #include <queue> u…
题意: 给定n项任务, 每项任务的完成用时t和完成每项任务前需要的k项任务, 求把所有任务完成的最短时间,有当前时间多项任务都可完成, 那么可以同时进行. 分析: 这题关键就是每项任务都会有先决条件, 要完成该项任务a必须先完成他的先决条件. 所以对于每个先决条件, 我们构建一条有向边到任务本身, 然后因为要求一个最小值, 按照最长路的方式松弛(dis[v] >= dis[u] + d, u是v的先决条件, d是v的完成时间,我们以边的终点完成时间作为边的权), 遇到没有出度的边记录答案. 方法…
传送门: http://poj.org/problem?id=1949 Chores Time Limit: 3000MS   Memory Limit: 30000K Total Submissions: 6368   Accepted: 3013 Description Farmer John's family pitches in with the chores during milking, doing all the chores as quickly as possible. At…
链接:poj 2253 题意:给出青蛙A,B和若干石头的坐标,现青蛙A想到青蛙B那,A可通过随意石头到达B, 问从A到B多条路径中的最长边中的最短距离 分析:这题是最短路的变形,曾经求的是路径总长的最小值,而此题是通路中最长边的最小值,每条边的权值能够通过坐标算出,由于是单源起点,直接用SPFA算法或dijkstra算法就能够了 SPFA 16MS #include<cstdio> #include<queue> #include<cmath> #include<…
Farmer John's family pitches in with the chores during milking, doing all the chores as quickly as possible. At FJ's house, some chores cannot be started until others have been completed, e.g., it is impossible to wash the cows until they are in the…
题目链接 :http://poj.org/problem?id=2472 Description In the movie "Blues Brothers", the orphanage where Elwood and Jack were raised may be sold to the Board of Education if they do not pay 5000 dollars in taxes at the Cook Country Assessor's Office…
题目链接 给一个n*m的图, 从0, 0这个点开始走,只能向右和向下. 图中有的格子有值, 求能获得的最大值. 其中有些格子可以传送到另外的格子, 有些格子不可以走. 将图中的每一个格子都看成一个点, 然后对它右边和下边的点连边, 如果是'#’就continue,  如果可以传送, 那么就对传送到的那个点连边, 同时也要向右边和下边连边, 因为可以选择不传送. 然后缩点求最长路就可以. 一个数组没有初始化RE了好多发..... #include <iostream> #include <…
题目链接 \(Description\) 有\(n\)个人在一条直线上跑步,每个人的起点 \(Si\).终点 \(Ei\) 已知:每个点可以放一个广告牌,一个人\(i\)能看到的广告牌数量为 \(Ei-Si+1\). 要求使每个人看到的广告牌数量不小于 \(k\) (若 \(Ei-Si+1<k\) 则应看到 \(Ei-Si+1\)).输出最少需要多少广告牌及方案. (这翻译2333) \(Solution\) 设 \(Sum_i\) 表示在 \([1,i]\) 广告牌总数,那么由题意有 \(Su…
XYZZY Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 4154   Accepted: 1185 Description The prototypical computer adventure game, first designed by Will Crowther on the PDP-10 in the mid-1970s as an attempt at computer-refereed fantasy g…
Father Christmas flymouse Time Limit: 1000MS   Memory Limit: 131072K Total Submissions: 3007   Accepted: 1021 Description After retirement as contestant from WHU ACM Team, flymouse volunteered to do the odds and ends such as cleaning out the computer…