-
[综合] 拓扑排序算法(AOV)简单例题 【例4-12】、家谱树
【例4-12】、家谱树 【问题描述】 有个人的家族很大,辈分关系很混乱,请你帮整理一下这种关系。 给出每个人的孩子的信息。 输出一个序列,使得每个人的后辈都比那个人后列出。 【输入格式】 第1行一个整数N(1<=N<=100),表示家族的人数。 接下来N行,第I行描述第I个人的儿子。 每...
76
热度 -
[综合] AOV拓扑排序(优先队列) HDU 1285 确定比赛名次
确定比赛名次 TimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):33731AcceptedSubmission(s):13226 ProblemDescription 有...
48
热度 -
[综合] 拓扑排序 信息奥赛一本通 1352:【例4-13】奖金
1352:【例4-13】奖金 时间限制:1000ms内存限制:65536KB提交数:607通过数:223 【题目描述】 由于无敌的凡凡在2005年世界英俊帅气男总决选中胜出,YaliCompany总经理Mr.Z心情好,决定给每位员工发奖金。公司决定以每个人本年在公司的贡献为标准来计算他们得到奖金的多...
7
热度 -
[综合] 带权并查集 区间统计
带权并查集区间统计 例题:HDUZjnuStadium(模板) HDU3038HowManyAnswersAreWrong 与普通并查集不同是新增加一个属性: dist[a]:表示a到父亲节点的距离 操作: 在路径压缩时,dis[x]+=dis[t] 在合并时,dis[r2]=dis[a]+x-di...
52
热度 -
[综合] 带权并查集种类并查集
带权并查集种类并查集 例题:种类并查集洛谷P2024食物链 与普通并查集不同是新增加属性: group[i]:group[i]表示它和fa[i]的关系,对于这三种种类,同类可以用0表示,其他两种分别用1表示该结点被父节点吃,2表示该节点吃父节点。 举个例子:现在有pa[3]=4;group[3]=...
19
热度 -
[综合] floyd 变形洛谷 P2419 [USACO08JAN]牛大赛Cow Contest
题目背景 [Usaco2008Jan] 题目描述 N(1≤N≤100)cows,convenientlynumbered1..N,areparticipatinginaprogrammingcontest.Asweallknow,somecowscodebetterthanothers.Eachco...
94
热度 -
[综合] poj 3661/P1353 [USACO08JAN] 跑步Running(区间DP)
Running TimeLimit:1000MS MemoryLimit:65536K TotalSubmissions:7477 Accepted:2810 Description Thecowsaretryingtobecomebetterathletes,soBessieisr...
65
热度 -
[综合] POJ 3662/洛谷 P1948 [USACO08JAN]电话线Telephone Lines (SPFA+二分)
Running TimeLimit:1000MS MemoryLimit:65536K TotalSubmissions:7477 Accepted:2810 Description Thecowsaretryingtobecomebetterathletes,soBessiei...
91
热度 -
[综合] 贪心法求树的最小支配集
贪心法求树的最小支配集 定义: 支配集:形式上,支配集可描述如下:给定无向图G=〈V,E〉,其中V是大小为n的点集,E是边集,那么V的一个子集S称为支配集当且仅当对于V-S中任何一个点v,都有S中的某个定点u,使得(u,v)∈E。 最小支配集:对于图G=(V,E)来说,最小支配集指的是从V中取尽量少...
92
热度 -
[综合] 树型DP求树的最小支配集
树型DP求树的最小支配集 定义: 支配集:形式上,支配集可描述如下:给定无向图G=〈V,E〉,其中V是大小为n的点集,E是边集,那么V的一个子集S称为支配集当且仅当对于V-S中任何一个点v,都有S中的某个定点u,使得(u,v)∈E。 最小支配集:对于图G=(V,E)来说,最小支配集指的是从V中取尽量...
83
热度 -
[综合] CodeForces - 873B Balanced Substring(技巧+map)
B.BalancedSubstring timelimitpertest 1second memorylimitpertest 256megabytes input standardinput output standardoutput Youaregivenastringsconsistingon...
89
热度 -
[综合] POJ 3619 SpeedReading 水题
SpeedReading TimeLimit:1000MS MemoryLimit:65536K TotalSubmissions:9743 Accepted:4584 Description AllK(1≤K≤1,000)ofthecowsareparticipatinginF...
68
热度 -
[综合] POJ 3616 MilkingTime
MilkingTime TimeLimit:1000MS MemoryLimit:65536K TotalSubmissions:12910 Accepted:5453 Description Bessieissuchahard-workingcow.Infact,sheisso...
80
热度 -
[综合] POJ 3614 Sunscree (优先队列)
Sunscreen TimeLimit:1000MS MemoryLimit:65536K TotalSubmissions:10586 Accepted:3702 Description Toavoidunsightlyburnswhiletanning,eachoftheC(...
46
热度 -
[综合] POJ 3617 / P2870 [USACO07DEC]最佳牛线,黄金Best Cow Line, Gold 模拟
题目描述 FJisabouttotakehisN(1≤N≤30,000)cowstotheannual"FarmeroftheYear"competition.Inthiscontesteveryfarmerarrangeshiscowsinalineandherdsthempastthejudge...
1
热度 -
[综合] POJ 3612/ P2885 [USACO07NOV]电话线Telephone Wire
题目描述 FarmerJohn'scowsaregettingrestlessabouttheirpoortelephoneservice;theywantFJtoreplacetheoldtelephonewirewithnew,moreefficientwire.Thenewwiringwill...
0
热度 -
[综合] POJ 3668 Game of Lines/洛谷 P2665 水题
题目背景 FarmerJohn最近发明了一个游戏,来考验自命不凡的贝茜。 题目描述 FarmerJohnhaschallengedBessietothefollowinggame:FJhasaboardwithdotsmarkedatN(2≤N≤200)distinctlatticepoints.D...
50
热度 -
[综合] POJ 3277 City Horizon /洛谷 P2061 [USACO07OPEN]
题目描述 FarmerJohnhastakenhiscowsonatriptothecity!Asthesunsets,thecowsgazeatthecityhorizonandobservethebeautifulsilhouettesformedbytherectangularbuilding...
32
热度 -
[综合] POJ 3613/P2886 [USACO07NOV]牛继电器Cow Relays
题目描述 Fortheirphysicalfitnessprogram,N(2≤N≤1,000,000)cowshavedecidedtorunarelayraceusingtheT(2≤T≤100)cowtrailsthroughoutthepasture. Eachtrailconnectstw...
2
热度 -
11
热度