关键点:对每个箱子的dimension 排个序,这样才能判断某个箱子是否真的能放入另一个箱子内建好图后求一个图中的最长路即可View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;const int inf = 100000000;int box[510][1010];int map[510][510];int n,d;bool ok;int count=0;bool solve(int a,int b){ int i,j; bool flag=t Read More
posted @ 2011-12-06 22:01 Because Of You Views(395) Comments(0) Diggs(0) Edit
中文题目竟然理解错了题意关键点:等级差距大于m的两个人不能直接或间接交易,而1必须是图的终点,所以最短路径中所有的点的等级都必须在【level【1】-m,level【1】+m】之间,所以可以枚举等级限制,for(i=level[1]-m;i<=level[1];i++){ 最短路算法且要保证 最短路径中每个点的等级都在【i,i+m】之间}就这样,带血的AC总是那么的鼓舞人心View Code #include<stdio.h>#include<string.h>#include<stdlib.h>const int inf = 1000000000;i Read More
posted @ 2011-12-06 12:31 Because Of You Views(446) Comments(0) Diggs(0) Edit