毫无疑问,最远点对肯定都在土包上所以可以先求凸包再两两枚举土包上的点这时候的点会比原先情况下少很多凸包用的是快速土包法这种方法在有些时候会退化成N^2英文例子:http://www.cs.princeton.edu/courses/archive/spr10/cos226/demo/ah/QuickHull.html大牛博客:http://www.cnblogs.com/Booble/archive/2011/03/10/1980089.htmlView Code //快速土包算法,递归#include <iostream>#include <math.h>#defin Read More
posted @ 2011-12-21 18:00 Because Of You Views(956) Comments(0) Diggs(0) Edit
基本功不够扎实 dubug 了好久View Code #include<cstdio>#include<cstring>int h[50][50];int a[50];int sum[50];int ans[50];int re[50];int n,m;int tot;bool goal;void dfs(int dep,int p){ int i,j; goal=true; for(i=1;i<=n;i++) if(sum[i]<a[i]) goal=false; if(goal && dep>tot) { ... Read More
posted @ 2011-12-21 11:17 Because Of You Views(282) Comments(0) Diggs(0) Edit
风格:notonlysuccess感觉刚开始就看notonlysuccess可能不太好,建议还是先研究一下网上的其他风格,搞透之后在比较一下,这样就能充分理解并加以运用了下面就从一些题来初识一下线段树hdu 1394 Minimum Inversion Number求逆序数的功能View Code #include<cstdio>#include<algorithm>using namespace std;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1const int maxn = 5010;i Read More
posted @ 2011-12-21 08:27 Because Of You Views(1255) Comments(0) Diggs(1) Edit