2014年1月8日

POJ 2786 Keep the Customer Satisfied 优先队列

摘要: ----------const int maxn=900000;const int maxm=10000;int n;struct Dat{ int v,lim; const bool operatorque;int main(){ while (~scanf("%d",&n)){ for (int i=0;ia[i].lim){ Dat top=que.top(); que.pop(); sum-=top.v; ans++; ... 阅读全文

posted @ 2014-01-08 23:01 电子幼体 阅读(145) 评论(0) 推荐(0) 编辑

UVA 1335 Beijing Guards 二分贪心

摘要: --------const int maxn=110000;const int maxm=10000;int n;int a[maxn];int lb[maxn],rb[maxn];bool C(int x){ lb[0]=a[0]; rb[0]=0; for (int i=1;ia[0]||rb[i]+rb[i-1]>x-a[0]) return false; if (lb[i]+rb[i]>x) return false; if (lb[i]>1; if (C(mid)){ ans=mid; ... 阅读全文

posted @ 2014-01-08 01:40 电子幼体 阅读(175) 评论(0) 推荐(0) 编辑

导航