摘要: 类似贪心。http://acm.nbu.edu.cn/v1.0/Problems/Problem.php?pid=2410View Code const int MM = 22222;int N,M;int cnt;int num[MM];struct Info { int val; int id; void reset() { val=maxint; id=-1; } bool friend operator<(Info x,Info y) { if(x.val!=y.val) return x.val<y.val; e... 阅读全文
posted @ 2013-04-01 21:58 zhang1107 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Gao The Sequence计算出一个差值数组C[i], 一种操作, 找一个delate有C[i]-=delaie,找任意多个C[j]-=D[j] (j<i) 使sum(D[j])=delate, 问能否使C[i]全部赋0.View Code #include<cstdio>#define ll long longint main(){ int n; while(~scanf("%d",&n)){ ll a,b,c,s=0,m=0; while(n--){ scanf("%lld%lld",&a,&b); . 阅读全文
posted @ 2013-04-01 13:35 zhang1107 阅读(195) 评论(0) 推荐(0) 编辑
摘要: DFS的过程中引用一个指针对数组的引用是很不靠谱的, 以后要引用, 尽量传一个值, 类似于用结构体, 封装一个数组。http://acm.hdu.edu.cn/showproblem.php?pid=4536View Code const int MM = 22222;int N,M, Q;struct Info { int belong[22]; int val[22];}p;vector<int>B[MM];int ret,g;int a[5][MM];Info t;void get_data() { int i,j,k; scanf("%d%d%d",&a 阅读全文
posted @ 2013-04-01 13:03 zhang1107 阅读(172) 评论(0) 推荐(0) 编辑