码迷,mamicode.com
首页 >  
搜索关键字:edge    ( 2375个结果
最小生成树
尽管堆优化的Prim用于处理稠密图不错,但是实际上很少有题目稠密图。所以一般直接上用并查集优化的Kruskal,简洁高效。int find(int x) {return x!=p[x]?p[x]=find(p[x]):x;}struct edge{ int u,v,c;}Edge[10001]...
分类:其他好文   时间:2014-10-02 21:46:13    阅读次数:243
epoll的两种工作模式
epoll有两种模式,Edge Triggered(简称ET) 和 Level Triggered(简称LT).在采用这两种模式时要注意的是,如果采用ET模式,那么仅当状态发生变化时才会通知,而采用LT模式类似于原来的select/poll操作,只要还有没有处理的事件就会一直通知....
分类:其他好文   时间:2014-10-01 02:33:11    阅读次数:503
POJ Big Christmas Tree(基础最短路)
Big Christmas Tree 题目分析:     叫你构造一颗圣诞树,使得 (sum of weights of all descendant nodes) × (unit price of the edge)尽量的小。转换后就是求根节点到每个节点的距离最短,也就是最短路。生成树可能会超时,我没试过。然后,求解最短路要用优化的解法不然会超时。最后的答案就是:sum = w[1]...
分类:其他好文   时间:2014-09-30 15:00:19    阅读次数:173
HDU 3966 Aragorn's Story 树链剖分
入门题 #include #include #include using namespace std; const int maxn = 50010; struct edge { int v, next; }e[maxn*2]; int n, m, q; int first[maxn], cnt; int top[maxn], tid[maxn], rank[maxn], sz[ma...
分类:其他好文   时间:2014-09-29 19:36:51    阅读次数:252
highchart,highstock,xAxis.labels 横轴坐标相互覆盖
现象:这是相邻的两个日期相互覆盖,不是数据重复。实际是 【6月13】和【7月13】互相覆盖了。这种现象发生在边界上,特别是outer edge 和plot area 大小接近时,或者xAxis.labels.overflow = 'justify',当然这是默认设置。还有,一般是显示月份之类间隔较大...
分类:其他好文   时间:2014-09-28 19:32:25    阅读次数:250
leetcode-Best Time to Buy and Sell Stock
一定要判断好边界条件,edge case很关键。 1 #include 2 #include 3 using namespace std; 4 5 class Solution { 6 public: 7 int maxProfit(vector &prices) { 8 ...
分类:其他好文   时间:2014-09-27 19:02:20    阅读次数:202
hdu 2874 Connections between cities hdu 2586 How far away ? LCA
两道lca模板题,用的是倍增法,nlogn预处理,logn查询。#include #include #include #include using namespace std;#define maxn 10100struct Edge{ int u,v,w,next;}e[100100];i...
分类:其他好文   时间:2014-09-25 20:24:27    阅读次数:236
安卓初步:通讯技术介绍&&安卓介绍
通讯技术: 1G 模拟制式 只能进行语音通话. 2G GSM, CDMA 收发短信和邮件. 2.5G GPRS, EDGE 访问wap网络数据.(图片, 壁纸, 文字信息) 3G WCDMA(联通), CDMA2000(电信), TD-SCDMA(移动) 发微博, 查看高清图片, 小电影. ...
分类:移动开发   时间:2014-09-24 22:05:37    阅读次数:308
UVa (一道比较复杂的广搜) 816 Abbott’s Revenge
题意:给出一个迷宫,在迷宫的节点处,面向某个方向只能向给定的方向转弯。给出起点和终点输出迷宫的最短路径,这里指的是刚刚离开起点的时刻,所以即使起点和终点重合路径也非空。分析:用三个变量来表示状态,r,c,dir,分别代表所处的位置和朝向。在输入数据的同时,也要初始化has_edge[r][c][di...
分类:其他好文   时间:2014-09-24 05:43:35    阅读次数:2220
SGU 101. Domino 欧拉回路
无向图欧拉回路 欧拉通路 #include #include using namespace std; struct edge { int v, next, b, id; }e[210]; int vis[210]; int first[10], cnt; int ans[210], len; int f[10]; int find(int x) { if(x != f[x]) ...
分类:其他好文   时间:2014-09-22 12:32:52    阅读次数:234
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!