随笔分类 -  优先队列+单调队列

摘要:/*两个约束条件求最短路,用优先队列*/#include#include#includeusing namespace std;#define N 110struct node {int u,v,w,f,next;}bian[N*N*4];int head[N],yong,money;void i... 阅读全文
posted @ 2014-08-04 11:41 HYDhyd 阅读(135) 评论(0) 推荐(0)
摘要:#include#include#include//水杯盛水问题,用优先队列不断从最小的边缘开始using namespace std;int n,m;#define N 400int p[N][N];struct node { int x,y,w; friend bool operatorb.w;... 阅读全文
posted @ 2014-04-29 17:27 HYDhyd 阅读(102) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#includeusing namespace std;#define N 30char map[N][N];struct node {double t;int x,y,f;friend bool operatorb.t... 阅读全文
posted @ 2014-03-11 18:25 HYDhyd 阅读(121) 评论(0) 推荐(0)
摘要:#include#include#includeusing namespace std;struct node {int num;friend bool operatorb.num;}};int main() {int count,n,k,i;char s[3];while(scanf("%d%d"... 阅读全文
posted @ 2014-03-04 11:29 HYDhyd 阅读(100) 评论(0) 推荐(0)
摘要:#include#include#define N 1100000int a[N];int fmin[N],fmax[N];int tmin[N],tmax[N];int dicmax(int l,int r,int f[],int k) { int mid; while(l=f[mid])//... 阅读全文
posted @ 2014-02-16 17:31 HYDhyd 阅读(124) 评论(0) 推荐(0)
摘要:#include#define N 1100000int minf[N],maxf[N],a[N],index[N];int main() {int n,i,k,first,end;while(scanf("%d%d",&n,&k)!=EOF) {first=end=0; for(i=0;iinde... 阅读全文
posted @ 2014-02-16 16:37 HYDhyd 阅读(117) 评论(0) 推荐(0)
摘要:#include//每次要吧生命值长的加入,吧生命用光的舍弃#define N 1100000int getmin[N],getmax[N],num[N],n,k,a[N];int main(){int i,first,last;while(scanf("%d%d",&n,&k)!=EOF) {fo... 阅读全文
posted @ 2013-12-12 16:32 HYDhyd 阅读(90) 评论(0) 推荐(0)
摘要:http://blog.pureisle.net/archives/477.htmlhttp://blog.sina.com.cn/s/blog_7058524b01017m8v.html 阅读全文
posted @ 2013-11-08 17:26 HYDhyd 阅读(110) 评论(0) 推荐(0)
摘要:#include#include#include#define N 1100using namespace std;struct node {char s[20];int power,num;friend bool operatorb.power;return a.num>b.num;}};int ... 阅读全文
posted @ 2013-11-06 13:29 HYDhyd 阅读(96) 评论(0) 推荐(0)