摘要: 就是用floyd求一个点点最短距离然后求个平均值题目:Six Degrees of Cowvin BaconTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2359Accepted: 1116DescriptionThe cows have been making movies lately, so they are ready to play a variant of the famous game "Six Degrees of Kevin Bacon". The game works like this 阅读全文
posted @ 2014-02-06 23:51 doubleshik 阅读(361) 评论(0) 推荐(1) 编辑
摘要: 简单的并查集类似 食物链那道题。 简单一下设a-x, a-y 表示 a属于龙帮和a属于蛇帮,以此来判断从属关系题目:Find them, Catch themTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 27729Accepted: 8453DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon a 阅读全文
posted @ 2014-02-06 23:24 doubleshik 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 给出n个数字, 对每个 取出每个 ai- aj . 问中位数是什么这道题是二分套二分。。 先二分枚举答案, 然后二分验证假设中位数是xai-aj = x (j 2 #include 3 #include 4 #include 5 using namespace std; 6 #define LL long long 7 #define INF 100000000+10 8 LL n; 9 LL num[100000+10];10 11 bool C(LL x)12 {13 LL cnt =0 ;14 for(int i=0;i=m/2+1)return true;20 ... 阅读全文
posted @ 2014-02-06 21:06 doubleshik 阅读(366) 评论(0) 推荐(0) 编辑
摘要: 题目比较长 , 就是给出 一些点的连线, 要求留下最多的线让他们不相交数据量比较大, 用二分的LIS题目:Bridging signalsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 9862Accepted: 5397Description'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed 阅读全文
posted @ 2014-02-06 17:59 doubleshik 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 题目的意思是给出一个序列,要求变成单调不上升或者单调不下降。 代价是 |A-B| 的总和网上都是说离散化。。虽然还是不太明白但是这道题终于有点感觉了首先可以看出变化后的序列中所有的数一定还在原数列中, 那么先对原数列排序a b1 3 2 4 5 3 9 -> 1 2 3 3 4 5 9然后dp[i][j] 表示第i个数, 把他变成 b[j] 所要画的最小代价dp[i][j] = dp[i-1] [ 0~j] + abs(b[j] - a[i]) 以此循环。虽然这道懂了但是感觉这个思路还是有点别扭。。智商拙计。。题目:Making the GradeTime Limit: 1000MSMe 阅读全文
posted @ 2014-02-06 17:37 doubleshik 阅读(514) 评论(0) 推荐(0) 编辑