Visitors hit counter dreamweaver
摘要: #include<cstdio>#include<cstring>#include<iostream>using namespace std;const int M=8010;struct Tree{ int l,r; int cnt;}T[3*M];int a[M],ans[M];int n,N; void build(int l,int r,int p){ T[p].l=l; T[p].r=r; T[p].cnt=r+1-l; if(l==r) return ; int mid=(l+r)>>1; build(l,mid,p<<1 阅读全文
posted @ 2012-03-08 23:59 Jason Damon 阅读(263) 评论(0) 推荐(0)
摘要: 这题的关键是方法。怎么才是相交的呢?一种方法是线段a的左边比线段b的左边小,同时a的右边比b的右边大。这时就可以构成一个相交。于是,我们可以根据左边的值来做降序排列,然后根据线段树来统计crosses。排名还在上升中。加油!#include <iostream>#include <cstdio>#include <fstream>#include <algorithm>#include <memory.h>#define MAXN 1005using namespace std;int M,N,K;int C[MAXN];struct 阅读全文
posted @ 2012-03-08 22:14 Jason Damon 阅读(229) 评论(0) 推荐(0)