摘要: 用可重集;首先按照x排好序,然后只要找到下界,插入,然后把y坐标大于它的都删掉就行; 1 #include 2 #include 3 using namespace std; 4 5 struct node 6 { 7 int a,b; 8 bool operators;16 multiset::iterator it;17 18 int main()19 {20 int t,n,ca=1;21 node p;22 scanf("%d",&t);23 while(t--)24 {25 s.clear();26 ... 阅读全文
posted @ 2013-10-31 22:42 Yours1103 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 基于hash的LCP算法; 1 #include 2 #include 3 #include 4 #define maxn 40010 5 using namespace std; 6 7 const int x=123; 8 int n,m,pos; 9 unsigned long long h[maxn],xp[maxn],hash[maxn];10 int rank[maxn];11 12 bool cmp(const int &a,const int &b)13 {14 return hash[a]=m)pos=max(pos,rank[i]);31 }32 ... 阅读全文
posted @ 2013-10-31 22:18 Yours1103 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 花了一个半小时的时间,终于把这个题目给A了;知道用后缀数组后,这个题目其实不难;就一个二分;用白书当模板其实还挺不错的! 1 #include 2 #include 3 #include 4 #define maxn 110009 5 using namespace std; 6 7 int s[maxn]; 8 int sa[maxn],t[maxn],t2[maxn],c[maxn],n; 9 10 void build_sa(int m) 11 { 12 int *x=t,*y=t2; 13 for(int i=0; i=0; i--)sa[--c[... 阅读全文
posted @ 2013-10-31 17:52 Yours1103 阅读(556) 评论(0) 推荐(0) 编辑
摘要: 对于两只狗在经过拐点之前,他们的运动可以简化为一只狗不动,另一只狗以他们的相对速度运动; 1 #include 2 #include 3 #include 4 #define maxn 66 5 #define eps 1e-6 6 using namespace std; 7 8 struct node 9 {10 double x,y;11 node(double x=0,double y=0):x(x),y(y){ }12 };13 node operator-(node u,node v){return node(u.x-v.x,u.y-v.y);}14 node o... 阅读全文
posted @ 2013-10-31 00:36 Yours1103 阅读(256) 评论(0) 推荐(0) 编辑