用bellman_ford的方法,将中间不断取较小值,修改为取较大值就可以了 #include <cstdio> #include <cstring> #include <iostream> using namespace std; ; int dp[N] , k , first[N] , val[N] , x , y , fa[N] , rec[N]; struct Edge{ int x , y , next , d; }e[N*N]; void add_edge(…
Free DIY Tour Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5815 Accepted Submission(s): 1855 Problem Description Weiwei is a software engineer of ShiningSoft. He has just excellently fulfi…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1534 思路:设s[i]表示工作i的开始时间,v[i]表示需要工作的时间,则完成时间为s[i]+v[i].于是可以列出下列不等式: FAS a b :b开始之后a结束,s[a]+v[a]>=s[b]; FAF a b :b结束之后a结束,s[a]+v[a]>=s[b]+v[b]; ASF a b :b结束之后a开始,s[a]>=s[b]+v[b]; ASA a b :b开始之后a开始,…
题目链接:http://codeforces.com/contest/734/problem/E E. Anton and Tree time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Anton is growing a tree in his garden. In case you forgot, the tree is a…
题目链接:http://icpc.njust.edu.cn/Problem/Hdu/1224/ 无负环. 代码如下: #include<bits/stdc++.h> using namespace std; typedef unsigned int ui; typedef long long ll; typedef unsigned long long ull; #define pf printf #define mem(a,b) memset(a,b,sizeof(a)) #define p…