E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Roads
【poj 1724】
ROADS
最短路(dijkstra+优先队列)
ROADSTimeLimit:1000MSMemoryLimit:65536KTotalSubmissions:12436Accepted:4591DescriptionNcitiesnamedwithnumbers1…Nareconnectedwithone-wayroads.Eachroadhastwoparametersassociatedwithit:theroadlengthandthe
ALPS233
·
2016-04-07 08:00
poj
dijkstra
[POJ 1724]
ROADS
[SPFA][DFS剪枝]
题目链接:[POJ1724]
ROADS
[SPFA][DFS剪枝]题意分析:求从点1到点N费用不超过K的最短路。
CatGlory
·
2016-04-01 10:00
最短路
DFS
CodeForces 25C
Roads
in Berland
RoadsinBerlandtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputThereare n citiesnumberedfrom1to n inBerland.Someofthemareconnectedbytwo-wayroads.Eachroadhasi
imwutianqi
·
2016-03-31 20:00
CodeForces 25D
Roads
not only in Berland (并查集)
RoadsnotonlyinBerlandtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputBerlandGovernmentdecidedtoimproverelationswithneighboringcountries.Firstofall,itwasdec
imwutianqi
·
2016-03-31 20:00
[POJ 3411]Paid
Roads
[BFS][状压]
题目链接:[POJ3411]PaidRoads[BFS][状压]题意分析:求从点1到达点N的最少花费。点和边可重复经过。V1->V2的费用分为两种:1.如果通过了某点C,那么可以考虑花费P通过;2.否则只能考虑花费R通过。解题思路:考虑常规搜索,单单考虑标记节点的话,有些重复的点就不经过了。再考虑标记边,边就不能重复了,两者都不行。根本上说是缺失了可以比较的状态,导致无法肯定什么时候应该访问,什么
CatGlory
·
2016-03-31 09:00
搜索
bfs
状压
HDU 1301 Jungle
Roads
(最小生成树Kruskal)
JungleRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):6073 AcceptedSubmission(s):4402ProblemDescriptionTheHeadElderofthetropicalislandofLagrishanh
llwwlql
·
2016-03-30 21:00
CodeForces
Roads
not only in Berland(并查集)
H- RoadsnotonlyinBerlandTimeLimit:2000MS MemoryLimit:262144KB 64bitIOFormat:%I64d&%I64uSubmit Status Practice CodeForces25DDescriptionBerlandGovernmentdecidedtoimproverelationswithneighboringc
Dacc123
·
2016-03-28 07:00
并查集
codeforces
【POJ 3411】 Paid
Roads
(搜索/DP)
【POJ3411】PaidRoads(搜索/DP)TimeLimit:1000MS MemoryLimit:65536KTotalSubmissions:6440 Accepted:2381DescriptionAnetworkofmroadsconnectsNcities(numberedfrom1toN).Theremaybemorethanoneroadconnectingonecitywi
ChallengerRumble
·
2016-03-25 17:00
PAT (Advanced Level) Practise 1087 All
Roads
Lead to Rome (30)
1087.AllRoadsLeadtoRome(30)时间限制200ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueIndeedtherearemanydifferenttouristroutesfromourcitytoRome.Youaresupposedtofindyourclientstheroutewiththeleastcostwhileg
jtjy568805874
·
2016-03-25 15:00
pat
HDU-1025-Constructing
Roads
In JGShining's Kingdom
ConstructingRoadsInJGShining’sKingdomTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):21098AcceptedSubmission(s):5967ProblemDescriptionJGShining’skingdomconsis
qq_32680617
·
2016-03-24 13:00
二分查找
动态规划
pku1947rebuilding
roads
树形DP
突然感觉自己代码写的好丑==今天突然手不听话了疯狂打错字==显然树形DP,表示fi,j是在第i个点,有j个点连着的最小值显然看每一棵子树的转移,显然背包Problem:1947User:BPM136 Memory:816KTime:0MS Language:G++Result:Accepted #include #include #include #include #include #inclu
BPM136
·
2016-03-24 10:00
树形DP
【POJ 1947】Rebuilding
Roads
(树型DP)
【POJ1947】RebuildingRoads(树型DP)TimeLimit:1000MS MemoryLimit:30000KTotalSubmissions:10607 Accepted:4863DescriptionThecowshavereconstructedFarmerJohn'sfarm,withitsNbarns(1 #include #include #include #inc
ChallengerRumble
·
2016-03-22 16:00
【POJ 1947】Rebuilding
Roads
(树型DP)
【POJ1947】RebuildingRoads(树型DP)TimeLimit:1000MS MemoryLimit:30000KTotalSubmissions:10607 Accepted:4863DescriptionThecowshavereconstructedFarmerJohn'sfarm,withitsNbarns(1 #include #include #include #inc
ChallengerRumble
·
2016-03-22 16:00
POJ1947 Rebuilding
Roads
(树形DP)
题目大概是给一棵树,问最少删几条边可以出现一个包含点数为p的连通块。任何一个连通块都是某棵根属于连通块的子树的上面一部分,所以容易想到用树形DP解决:dp[u][k]表示以u为根的子树中,包含根的大小k的连通块最少的删边数要求答案就是min(dp[u][p],min(dp[v][p]+1)),u是整棵树的根,v是其他结点转移从若干个子树各自选择要提供几个k转移,不过指数级时间复杂度,当然又是树上背
WABoss
·
2016-03-13 20:00
HDU 1025 —— Constructing
Roads
In JGShining's Kingdom 最长上升子序列
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1025题意:有n个穷城市,n个富城市,每个穷城市都要从某个富城市运输一种物资(穷城市和富城市的物资供需一对一),需要建立道路,但任意两条路不能交叉;穷城市和富城市分 别位列平行线两侧(均按1-n分布);给出城市个数n,下面n行输入两个数字p和r表示穷城市p要从富城市r运输物资,即需要在p和r之间建路,问
L_avender
·
2016-03-07 22:00
LIS
Constructing
Roads
In JGShining's Kingdom
点击打开题目链接 本题目是考察 最长递增子序列的 有n^2 n(logn) n^2 会超时的下面两个方法的代码 思路 可以百度LIS LCSdp里面存子序列n(logn) 代码#include #include #include #include #include #defineN500000 usingnamespacestd; introad[N],dp[N],n,len; inttwo
WR_technology
·
2016-03-05 20:00
hdu 1301 Jungle
Roads
【最小生成树】【MST】
JungleRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):6017 AcceptedSubmission(s):4356ProblemDescriptionTheHeadElderofthetropicalislandofLagrishanh
mengxiang000000
·
2016-03-04 19:00
HDU
杭电
1301
1301
hdu 1102 Constructing
Roads
(最小生成树)
ProblemDescriptionThereareNvillages,whicharenumberedfrom1toN,andyoushouldbuildsomeroadssuchthateverytwovillagescanconnecttoeachother.WesaytwovillageAandBareconnected,ifandonlyifthereisaroadbetweenAand
zyq_19960204
·
2016-03-03 20:00
HDU 1102.Constructing
Roads
【最小生成树kruskal算法变形】【3月2】
ConstructingRoadsProblemDescriptionThereareNvillages,whicharenumberedfrom1toN,andyoushouldbuildsomeroadssuchthateverytwovillagescanconnecttoeachother.WesaytwovillageAandBareconnected,ifandonlyiftherei
a995549572
·
2016-03-02 18:00
C++
ACM
HDU
kruskal
CodeForces 629E Eamil Door and
Roads
树形dp 概率
Ubuntu下的搜狗好痛苦。。中文翻译描述FamilDoor的城市地图看起来像一棵树(无向无环图)所以其他人叫他Treeland。城市里有n个由n-1条双联通边连接起来的节点。FamilDoor有m个朋友生活在这城市。第i个朋友住在ui而且在vi工作。在城市里的每个人都不开心因为在他们家和工作地点间只有一条简单路径。FamilDoor计划构造1条新边而且他会在n(n−1)/2种可选方案中随机选择一
huanghongxun
·
2016-02-25 23:00
动态规划
概率
codeforces
LCA
树形
Famil Door and
Roads
(树形dp,lca)
FamilDoor’sCitymaplookslikeatree(undirectedconnectedacyclicgraph)sootherpeoplecallitTreeland.Thereare n intersectionsinthecityconnectedby n - 1 bidirectionalroads.Thereare m friendsofFamilDoorlivingin
Kirito_Acmer
·
2016-02-25 20:00
LCA
树形DP
Jungle
Roads
(kruskar)
JungleRoads题目链接;http://poj.org/problem?id=1251TimeLimit: 1000MS MemoryLimit: 10000KTotalSubmissions: 22633 Accepted: 10544DescriptionTheHeadElderofthetropicalislandofLagrishanhasaproblem.Aburstofforei
若流芳千古
·
2016-02-24 22:00
Wizards and
Roads
笛卡尔树+树贪心+阅读题
D.WizardsandRoads题目连接:http://www.codeforces.com/contest/167/problem/DDescriptionInsomecountrylivewizards.Theylovetobuildcitiesandroads.Thecountryusedtohavekcities,thej-thcity(1 ≤ j ≤ k)waslocatedatapo
qscqesze
·
2016-02-19 21:00
【POJ】1251 - Jungle
Roads
(克鲁斯塔尔,并查集)(坑题)
JungleRoadsTimeLimit:1000MS MemoryLimit:10000KB 64bitIOFormat:%I64d&%I64uSubmit StatusDescriptionTheHeadElderofthetropicalislandofLagrishanhasaproblem.Aburstofforeignaidmoneywasspentonextraroa
wyg1997
·
2016-02-19 20:00
CodeForces 25D -
Roads
not only in Berland(并查集题目)
本题为并查集题目,个人觉得本题的答案并不唯一题目的大意为:为了方便沟通任一两地之间,所以删除一条路的时候沟通另外一条路(一天只能进行一次),并且让花费的天数尽可能的少,所以在这里就得用并查集对是否成环进行判断。对成环的路断开,然后在端点连接另外一条与上一个环没有交点的路线,渣渣可能说的不太详细,各大神结合代码和题目样例再进行思考吧,就说到这里,下面附上AC代码。这里写代码片#include #in
qq_32866009
·
2016-02-19 11:00
并查集
codeforces
Codeforces 25C
Roads
in Berland(floyed)
题目:http://codeforces.com/problemset/problem/25/C代码:#include #include #include usingnamespacestd; longlongmaps[305][305]; intn,m; intmain() { scanf("%d",&n); for(inti=1;ic) { maps[a][b]=maps[b][a]=c
qq_32473657
·
2016-02-18 14:00
ArcGIS制图——多图层道路压盖处理
生成名为All-
Roads
的图层组,如他所看到的,符号级别绘制将对图层组内图层符号起作用;图层组设置符号等级[2] 在内容列表中,右键单击图层组All-
Roads
。选择属性。
phlsheji
·
2016-02-17 17:00
poj 1724
ROADS
传送门:http://poj.org/problem?id=1724注意有重边!①Dijsktra+优先队列(16ms):#include #include #include #include #include usingnamespacestd; constintINF=0x3f3f3f3f; constintmaxn=10010; intT,n,k,r,e; inthead[maxn];
rachelsg
·
2016-02-16 16:00
poj 3411 Paid
Roads
(DFS)
题目链接:http://poj.org/problem?id=3411题意:有n座城市,编号1~n,从a到b如果已经经过c城市,则需要p费用,否则需要r费用,问从1到n的最小费用是多少。①DFS:#include #include #include #include #include usingnamespacestd; constintINF=0x3f3f3f3f; constintmaxn=
rachelsg
·
2016-02-14 16:00
POJ 2631
Roads
in the North(树的直径)
Description给出一棵无向树,求树的直径,即树上两点之间的最长距离Input每行三个整数a,b,c表示树上a点与b点之间有权值为c的一条边,以文件尾结束输入Output输出树的直径SampleInput516145639268617SampleOutput22Solution先给出一个结论:从任一点s出发,距此点距离最远的点为直径的一个端点a,那么距a最远的点b即为直径的另一个端点,a与b
V5ZSQ
·
2016-02-12 14:00
1002 All
Roads
Lead to Rome
这个题就是求最短路径,然而还有一些限制条件就是最短路一样的时候顶点的欢乐值要最大,欢乐值一样的时候路径上顶点的个数要最小(不包括源点),另外要顺带求出最短路径的个数。实现的时候我们可以用优先队列来优化dijkstra算法,每更新一个数值其他的也要相应的更新,另外在求解路径个数的时候假设我们以rout[u]表示最短到达u的最短路的个数,那么对于d[v]>d[u]+c的时候就有rout[v]=rou
xingxing1024
·
2016-02-10 16:00
poj 2421 Constructing
Roads
ConstructingRoadsTimeLimit: 2000MS MemoryLimit: 65536KTotalSubmissions: 21632 Accepted: 9175DescriptionThereareNvillages,whicharenumberedfrom1toN,andyoushouldbuildsomeroadssuchthateverytwovillagescanc
yao1373446012
·
2016-02-09 19:00
POJ 2437:Muddy
roads
【贪心】
MuddyroadsTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 2814 Accepted: 1317DescriptionFarmerJohnhasaproblem:thedirtroadfromhisfarmtotownhassufferedintherecentrainstormsandnowcontains(1 #inclu
lin14543
·
2016-02-08 14:00
poj 1251 Jungle
Roads
(最小生成树)
思路:最小生成树模板。#include #include #include usingnamespacestd; constintINF=0x3f3f3f3f; constintMAXN=110; boolvis[MAXN]; intlowc[MAXN]; intPrim(intcost[][MAXN],intn) { intans=0; memset(vis,false,sizeof(vis
u014552756
·
2016-02-02 23:00
POJ-2631-
Roads
in the North-树的直径(最长路)
http://poj.org/problem?id=2631裸的求树直径,两次bfs这种方法是利用了树的直径的一个性质:距某个点最远的叶子节点一定是树的某一条直径的端点。这样就可以首先任取一个点,bfs求出离其最远的点,在用同样的方法求出离这个叶子节点最远的点,此时两点间的距离就是树的直径。#include #include #include #include #include #include
viphong
·
2016-02-02 13:00
(MST) HDOJ 1102 Constructing
Roads
怎么说呢这题就是个模板题但是hud你妹夫啊说好的只有一组数据呢???嗯???wa到家都不认识了好吗#include #include #include #include #include #defineINF0x3f3f3f3f usingnamespacestd; typedefpairpii; structcmp{ booloperator()(constpiia,con
失踪百景
·
2016-01-29 08:00
poj1947 Rebuilding
Roads
树形dp 背包
poj1947RebuildingRoads题目大意:求树上隔离出k个点的最少删除的边数。n,k #include #include usingnamespacestd; constintN=200; constintinf=0x7fffffff; structE{intto,nxt;}edge[N*2]; intidx[N],tot=1,cnt[N]; intn,k,ans=inf,root;
yxr0105
·
2016-01-28 15:00
dp
poj
背包
树形DP
HDOJ 1025 Constructing
Roads
In JGShining's Kingdom (LIS nlogn)
ConstructingRoadsInJGShining'sKingdomTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):20601 AcceptedSubmission(s):5814ProblemDescriptionJGShining'skingd
helloiamclh
·
2016-01-26 20:00
POJ 2421 Constructing
Roads
题目链接:[kuangbin带你飞]专题六最小生成树D-ConstructingRoads输入矩阵,求最小生成树。其中有的边已经联通,不需要再计算,将其权值置为0即可。//#include"stdafx.h" #include #include #include #include #include usingnamespacestd; structedge { ints,e,w; }; edg
Dextrad_ihacker
·
2016-01-24 09:00
poj
POJ 1251 Jungle
Roads
(Kruskal)
题目链接:[[kuangbin带你飞]专题六最小生成树A-JungleRoads(http://acm.hust.edu.cn/vjudge/contest/view.action?cid=66965#problem/A)Kruskal算法求最小生成树题意:求图的最小生成树,主要注意输入!!Kruskal算法:并查集+排序//#include"stdafx.h" #include #include
Dextrad_ihacker
·
2016-01-22 14:00
poj
kruskal
poj 1947 Rebuilding
Roads
树形DP
题意:给你一棵节点为n的树,问至少砍几刀可以孤立出一棵节点为m的子树。分析:我的树形DP还不是很熟,所以也是看了别人的题解才勉强写了出来。http://www.cnblogs.com/yu-chao/archive/2011/07/18/2109730.html就是这个网址大家如果看不懂我的就去看这个吧。首先这题一看就是树形DP(就不告诉你为什么)。用f[x,j]表示以节点x为根要留j个节点(包括
qq_33229466
·
2016-01-22 14:00
ZSTU 4213: One-Way
Roads
【图论】【欧拉回路】
4213:One-WayRoadsTimeLimit: 1Sec MemoryLimit: 128MB SpecialJudgeSubmit: 162 Solved: 56DescriptionIntheACMkingdom,thereare N citiesconnectedby M two-wayroads.Thesecitiesareconnected,i.e.,onecanreach
wlx65003
·
2016-01-21 22:00
编程
C++
算法
ACM
hdu 1102 Constructing
Roads
(Prim)
FontSize:←→ProblemDescriptionThereareNvillages,whicharenumberedfrom1toN,andyoushouldbuildsomeroadssuchthateverytwovillagescanconnecttoeachother.WesaytwovillageAandBareconnected,ifandonlyifthereisaroad
wqy20140101
·
2016-01-13 11:00
最小生成树
ACM
杭电
poj--2631--
Roads
in the North(树的直径 裸模板)
RoadsintheNorthTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 2389 Accepted: 1173DescriptionBuildingandmaintainingroadsamongcommunitiesinthefarNorthisanexpensivebusiness.Withthisinmind,theroad
qq_29963431
·
2016-01-12 20:00
HDU 1025.Constructing
Roads
In JGShining's Kingdom【最长上升子序列n×logn算法】【1月6】
ConstructingRoadsInJGShining'sKingdomProblemDescriptionJGShining'skingdomconsistsof2n(nisnomorethan500,000)smallcitieswhicharelocatedintwoparallellines.Halfofthesecitiesarerichinresource(wecallthemric
a995549572
·
2016-01-06 19:00
C++
算法
ACM
HDU
最长上升子序列
【杭电oj】1102 - Constructing
Roads
(畅通工程,最小生成树)
ConstructingRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):18366 AcceptedSubmission(s):7018ProblemDescriptionThereareNvillages,whicharenumberedfr
wyg1997
·
2016-01-05 21:00
lingo求解最短路和最大流问题
最短路问题model:sets:cities/A,B1,B2,C1,C2,C3,D/;
roads
(cities,cities)/AB1,AB2,B1C1,B1C2,B1C3,B2C1,B2C2,B2C3
lusongno1
·
2016-01-02 10:00
lingo
【codechef】Ancient Berland
Roads
(线段树)
题目描述在古老的宝兰国有N座城市和M条双向道路。随着时间的流逝,一些道路渐渐变得破旧,最后因为损坏而无法使用,而从来没有人维修这些道路。作为古宝兰国历史的热爱者,你想要做一个小小的研究。为此,你想要写一个程序来处理以下的操作:•DK,代表输入中的第K条道路损坏了。道路从1开始编号;•PAB,代表编号为A的城市的人口数变为了B。我们称一些城市构成的集合为一个区域,当且仅当对于集合中的任意两座城市,都
cacyth
·
2015-12-27 17:00
【ZSTU4213 2015年12月浙理工校赛 D】【双连通分量tarjan算法】One-Way
Roads
无向连通图确定边的方向使得全图任意两点间可达
4213:One-WayRoadsTimeLimit: 1Sec MemoryLimit: 128MB SpecialJudgeSubmit: 133 Solved: 45DescriptionIntheACMkingdom,thereare N citiesconnectedby M two-wayroads.Thesecitiesareconnected,i.e.,onecanreach
snowy_smile
·
2015-12-23 12:00
构造
图论-双联通分量
hdu1025 Constructing
Roads
In JGShining's Kingdom
转载自:http://blog.csdn.net/ice_crazy/article/details/7536332代码非转载/*分析: 太NB了,没话说了。DP+二分。摘:链接:http://acm.hdu.edu.cn/forum/read.php?tid=15580&fpage=0&page=1假设存在一个序列d[1..9]=215364897,可以看出来它的LIS长度为5。下面一步一步试
EventQueue
·
2015-12-21 20:00
算法
dp
ACM
二分
hduoj
上一页
7
8
9
10
11
12
13
14
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他