码迷,mamicode.com
首页 >  
搜索关键字:travel    ( 620个结果
hdu5431 Travel
Problem DescriptionJack likes to travel around the world, but he doesn’t like to wait. Now, he is traveling in the Undirected Kingdom. There arencitie...
分类:其他好文   时间:2015-09-15 23:05:46    阅读次数:167
HDU 5441 Travel 并查集
HDU 5441 Travel题意:一张无向图,q个查询,对于每个x,有多少对点之间的路径中最长的一条路不大于x。思路:比赛时王秋平写的,我补下题。这题也比较简单,将边排序,从小到大加到并查集,对查询也排序,从小到大对于每个查询把不大于x的边加到并查集,用cnt[y]记录以y为根的连通块有多少节点,...
分类:其他好文   时间:2015-09-15 21:55:36    阅读次数:169
hdu 5441 Travel (2015长春网赛)
http://acm.hdu.edu.cn/showproblem.php?pid=5441题目大意是给一个n个城市(点)m条路线(边)的双向的路线图,每条路线有时间值(带权图),然后q个询问,每个询问一个时间值求不大于这个时间的可以连通的城市有多少种连法比如样例中第一个询问6000,不大于6000...
分类:其他好文   时间:2015-09-14 21:05:48    阅读次数:199
hdu 5441 travel 离线+带权并查集
Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Problem DescriptionJack likes to travel around the world, but he doe...
分类:其他好文   时间:2015-09-14 15:25:31    阅读次数:207
并查集 HDOJ 5441 Travel
题目传送门题意:给一张无向图,问存在多少(a, b)表示a点到b点经过的边值小于等于x ((a,b) 和 (b, a)属于不同的方案)分析:首先将边权值和查询x值升序排序,从前往后扫描边,累加从u和v两个集合各自选取一个组成(a, b)的方案数(u,v属于不同的集合),不能从一个集合选两个,因为同一...
分类:其他好文   时间:2015-09-14 11:58:26    阅读次数:166
Morris post order traversal algorithm
Sept. 5, 2015花时间把代码读明白,比光看书强.动手写代码,改代码,兴趣是最好的老师. 多记几个例子, 增加情趣.举个例子关于中序遍历, 4 / \ 2 6 / \ / \ 1 3 5 7easy way to travel is to remem...
分类:其他好文   时间:2015-09-14 07:03:30    阅读次数:169
hdu 5441 Travel 长春网赛
想到最小生成树的sort+并查集算法,于是可以顺便用并查集维护点所在的连通分量的点的数目(不知道学名是不是这么说),记为poi[v];然后当边权限制为f[i].w时,其答案为ww[i]=ww[i-1]-(poi[u]-1)*poi[u]-(poi[v]-1)*poi[v]+(poi[u]+poi[v...
分类:其他好文   时间:2015-09-13 21:29:37    阅读次数:167
hdu 5441 Travel(并查集)
Problem DescriptionJack likes to travel around the world, but he doesn’t like to wait. Now, he is traveling in the Undirected Kingdom. There are n cit...
分类:其他好文   时间:2015-09-13 21:29:20    阅读次数:129
hdu 5441 Travel 离线带权并查集
TravelTime Limit: 1 Sec Memory Limit: 256 MB题目连接http://acm.hdu.edu.cn/showproblem.php?pid=5441DescriptionJack likes to travel around the world, but he...
分类:其他好文   时间:2015-09-13 18:37:45    阅读次数:190
Gym - 100342I Travel Agency(割顶)
题意:给一个无向图,对于每个节点a,统计有多少点对(u,v)之间的路径必须经过a。 思路:首先求一个图的割顶,在这颗dfs时间树中我们可以发现,对于一个结点u,如果他的一颗子树不能连回u以上的结点,那么这一棵子树的结点与除u以外的结点之间的路径必然经过u,那么在dfs的过程中不断更新答案即可。 #include #include #include #include #include #incl...
分类:其他好文   时间:2015-08-30 21:27:03    阅读次数:123
620条   上一页 1 ... 32 33 34 35 36 ... 62 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!