摘要: B. Two Heapstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputValera has 2·n cubes, each cube contains an integer from 10 to 99. He arbitrarily chooses n cubes and puts them in the first heap. The remaining cubes form the second heap.Valera dec 阅读全文
posted @ 2013-10-11 22:33 Ramanujan 阅读(318) 评论(0) 推荐(0) 编辑
摘要: Problem AACM contest and BlackoutIn order to prepare the “The First National ACM School Contest”(in 20??) the major of the city decided to provide all the schools with a reliable source of power. (The major is really afraid of blackoutsJ). So, in order to do that, power station “Future” and one scho 阅读全文
posted @ 2013-10-11 22:22 Ramanujan 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 1.二分图判定染色模板bool dfs(int u, int cur){ col[u]=cur; for(int i=0; i1) ans=0; if(ans==INF) ans=-1;}4.tarjan 求强连通分量void tarjan(int u){ dfn[u]=low[u]=++tsp; s.push(u); ins[u]=true; int i, v, tl=g[u].size(); for(i=0; i=dfn[u]){ iscut[u]=1; edge k; ... 阅读全文
posted @ 2013-10-11 22:16 Ramanujan 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 1.最佳完美匹配------km算法bool match(int u){ s[u]=true; for(int v=1; v<=n; v++){ if(t[v]) continue; int d=lx[u]+ly[v]-w[u][v]; if(!d){ t[v]=true; if(lft[v]==-1 || match(lft[v])){ lft[v]=u; return true; } } ... 阅读全文
posted @ 2013-10-11 21:44 Ramanujan 阅读(544) 评论(0) 推荐(0) 编辑