图论
hehedad
这个作者很懒,什么都没留下…
展开
-
2020牛客暑期多校训练营(第五场)B Graph
根据题目描述我们可以知道,无论添加的时间顺序,添加a-b的边的大小一定是固定的,即a-b上的路径上的所有长度的异或,所以题目就可以简化成寻找完全图的最小生成树。 设dis[n]为0-n点的链路上所有边长的的异或,则在之前所说的完全图中,a-b的边长就是dis[a] ^ dis[b],即为a-b上的路径上的所有长度的异或(假设最小公共祖先为c,dis[a]^dis[b]中有两段多余的0-c的异或会被相互中和掉)。则相当于每个点有一个值dis[n],而两点之间边长即为dia[a]^dis[b]...原创 2020-07-25 17:41:25 · 1680 阅读 · 7 评论 -
UVA - 10480 Sabotage 最大流最小割+ 输出割边集
因为是pdf形式我就不把题目弄上来了,就写主要需要注意的两点: 1.输出割边集。正确的写法是先按照源点开始dfs,如果某一边得剩余流量大于0就继续向下探索另一个点并标记,等于零就跳过这一边。最后把所有的边找出来,看看如果有两个点标记不一样(一个标记了一个没标记),就输出这个边就好了(因为我们建立的是双向便所以别忘了遍历时每次加2)。 但是我在没看这种做法得时候,我是想把所有得剩余流量...原创 2018-08-09 16:42:02 · 156 阅读 · 0 评论 -
HDU - 3488 Tour(KM)
In the kingdom of Henryy, there are N (2 <= N <= 200) cities, with M (M <= 30000) one-way roads connecting them. You are lucky enough to have a chance to have a tour in the kingdom. The route...原创 2018-08-07 09:26:24 · 167 阅读 · 0 评论 -
HDU - 1151 Air Raid(最小路径覆盖)
Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an intersection and walking through town's stre...原创 2018-08-02 16:31:15 · 190 阅读 · 0 评论 -
POJ - 2594 Treasure Exploration(floyd传递闭包+最小路径覆盖)
Treasure ExplorationTime Limit: 6000MS Memory Limit: 65536K Total Submissions: 9490 Accepted: 3871 DescriptionHave you ever read any book about treasure exploration? Have you e...原创 2018-08-02 20:02:20 · 165 阅读 · 0 评论 -
Dinic+弧优化模板
#include<iostream>#include<cstdio>#include<cstring>#include<queue>#include<algorithm>using namespace std;#define inf 0x3f3f3f3fconst int maxn = 100010;const int ...原创 2018-08-07 16:00:58 · 296 阅读 · 2 评论 -
POJ - 3281 Dining (拆点+dinic最大流)
DiningTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 22184 Accepted: 9851 DescriptionCows are such finicky eaters. Each cow has a preference for certain foods and d...原创 2018-08-07 19:19:42 · 143 阅读 · 0 评论 -
CodeForces 967F. Aztec Catacombs(思维建树图)
F. Aztec Catacombstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIndiana Jones found ancient Aztec catacombs containing a golde...原创 2018-08-03 14:12:50 · 248 阅读 · 0 评论 -
POJ - 3436 ACM Computer Factory (拆点+网络流)
ACM Computer FactoryTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 9241 Accepted: 3412 Special Judge DescriptionAs you know, all the computers used for ACM ...原创 2018-08-08 08:56:21 · 281 阅读 · 0 评论 -
POJ - 2195 Going Home (最小费用最大流)
Going HomeTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 25156 Accepted: 12597 DescriptionOn a grid map there are n little men and n houses. In each unit time, ever...原创 2018-08-08 16:30:41 · 117 阅读 · 0 评论 -
HDU - 6386 Age of Moyu
Mr.Quin love fishes so much and Mr.Quin’s city has a nautical system,consisiting ofNN ports and MM shipping lines. The ports are numbered 11 to NN. Each line is occupied by a Weitian. Each Weitian has...原创 2018-08-15 23:37:33 · 192 阅读 · 0 评论 -
顺便记下kuangbin巨巨的HK
#include<cstdio>#include<iostream>#include<vector>#include<queue>using namespace std;#define inf 0x3f3f3f3fconst int maxn = 3005;vector<int>G[maxn];int un;int m...转载 2018-08-02 11:20:54 · 164 阅读 · 0 评论 -
HDU - 2389 Rain on your Parade(HK函数)
Rain on your Parade Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 655350/165535 K (Java/Others) Total Submission(s): 5383 Accepted Submission(s): 1775 Problem Descri...原创 2018-08-02 11:19:28 · 249 阅读 · 0 评论 -
HDU - 3605 Escape
2012 If this is the end of the world how to do? I do not know how. But now scientists have found that some stars, who can live, but some people do not fit to live some of the planet. Now scientists wa...原创 2018-08-09 20:05:42 · 133 阅读 · 0 评论 -
HDU - 3829 Cat VS Dog (最大独立集)
Cat VS Dog Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others) Total Submission(s): 4539 Accepted Submission(s): 1670 Problem Description The ...原创 2018-08-05 20:38:48 · 164 阅读 · 0 评论 -
HDU - 1045 Fire Net (缩点建图+二分图)
Fire Net Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14784 Accepted Submission(s): 8936 Problem Description Suppos...原创 2018-08-01 09:51:09 · 457 阅读 · 0 评论 -
HDU - 2444 The Accomodation of Students (判断二分图+匈牙利算法)
The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8705 Accepted Submission(s): 3830 Problem Des...原创 2018-08-01 14:20:43 · 125 阅读 · 0 评论 -
POJ - 2289 Jamie's Contact Groups
Jamie's Contact GroupsTime Limit: 7000MS Memory Limit: 65536K Total Submissions: 8667 Accepted: 2941 DescriptionJamie is a very popular girl and has quite a lot of friends, so ...原创 2018-08-06 10:27:31 · 486 阅读 · 0 评论 -
HDU - 3081 Marriage Match II (最大流+二分+并查集+(*你*别忘了别再建重边了))
Presumably, you all have known the question of stable marriage match. A girl will choose a boy; it is similar as the game of playing house we used to play when we are kids. What a happy time as so man...原创 2018-08-10 11:53:55 · 189 阅读 · 0 评论 -
HDU - 1281 棋盘游戏
棋盘游戏 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6370 Accepted Submission(s): 3699 Problem Description 小希和Gardon在玩一...原创 2018-08-01 16:51:05 · 272 阅读 · 0 评论 -
HDU - 2255 奔小康赚大钱 (二分图的最佳完美匹配)
奔小康赚大钱 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 13366 Accepted Submission(s): 5827 Problem Description 传说在遥远的地方...原创 2018-08-06 18:36:32 · 119 阅读 · 0 评论 -
POJ - 3189 Steady Cow Assignment(二分+二分图多重匹配)
Steady Cow AssignmentTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 7289 Accepted: 2506 DescriptionFarmer John's N (1 <= N <= 1000) cows each reside in one of...原创 2018-08-06 20:25:51 · 326 阅读 · 0 评论 -
POJ - 2112 Optimal Milking(floyd传递闭包+二分枚举+二分图多重匹配)
Optimal MilkingTime Limit: 2000MS Memory Limit: 30000K Total Submissions: 19622 Accepted: 7022 Case T...原创 2018-08-06 23:57:37 · 149 阅读 · 0 评论 -
POJ - 2516 Minimum Cost (最小费用最大流)
Minimum CostTime Limit: 4000MS Memory Limit: 65536K Total Submissions: 18305 Accepted: 6465 DescriptionDearboy, a goods victualer, now comes to a big problem, and he needs your...原创 2018-08-08 19:27:24 · 166 阅读 · 0 评论 -
HDU5977 Garden of Eden(高位前缀和+点分治)
When God made the first man, he put him on a beautiful garden, the Garden of Eden. Here Adam lived with all animals. God gave Adam eternal life. But Adam was lonely in the garden, so God made Eve. Whe...原创 2018-10-31 21:20:52 · 258 阅读 · 0 评论 -
HDU - 6214 Smallest Minimum Cut(最小割边集的最小数量)
Consider a network G=(V,E)G=(V,E) with source ss and sink tt. An s-t cut is a partition of nodes set VV into two parts such that ss and tt belong to different parts. The cut set is the subset of EE wi...原创 2018-08-24 19:08:57 · 272 阅读 · 0 评论 -
ZOJ - 4097 Rescue the Princess (边双联通缩点无向图+思维lca)
Rescue the PrincessPrincess Cjb is caught by Heltion again! Her knights Little Sub and Little Potato are going to H...原创 2019-04-20 00:56:06 · 271 阅读 · 0 评论 -
CodeForces - 76A Gift (两个取值方向的最小生成树)
gThe kingdom of Olympia consists ofNcities andMbidirectional roads. Each road connects exactly two cities and two cities can be connected with more than one road. Also it possible that some roads ...原创 2019-06-05 21:06:01 · 319 阅读 · 0 评论 -
HDU - 6582 Path(spfa+最大流)
Years later, Jerry fell in love with a girl, and he often walks for a long time to pay visits to her. But, because he spends too much time with his girlfriend, Tom feels neglected and wants to prevent...原创 2019-07-24 19:29:24 · 513 阅读 · 4 评论 -
2019牛客暑期多校训练营(第六场)H Train Driver(BFS+优化+思维)
链接:https://ac.nowcoder.com/acm/contest/886/H来源:牛客网题目描述It's time for training! WJJ, DYX and ZZH from the team Nonsense Time want to find a place in BUAA (shorten for Beihang University) to hold ...原创 2019-08-05 11:28:46 · 321 阅读 · 0 评论 -
2019牛客暑期多校训练营(第五场) subsequence 2(topo)
链接:https://ac.nowcoder.com/acm/contest/885/H来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288KSpecial Judge, 64bit IO Format: %lld题目描述There is a hidden string of length n composed of ...原创 2019-08-01 20:06:01 · 322 阅读 · 0 评论 -
HDU - 6705 path (K短路+剪枝)
进入报名链接)~ path Time Limit: 2000/2000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1404Accepted Submission(s): 298 Problem Descripti...原创 2019-08-24 19:58:38 · 327 阅读 · 0 评论 -
HDU - 6714 || 2019 百度之星初赛三 最短路 2(思维+spfa)
最短路 2Time Limit: 6000/4000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 417Accepted Submission(s): 108Problem Description小 A 是社团里的工具人,有一天他的朋友给了他一个n个...原创 2019-08-25 16:49:05 · 297 阅读 · 0 评论 -
沈阳网络赛 D Fish eating fruit(点分治)
State Z is a underwater kingdom of the Atlantic Ocean. This country is amazing. There arenncities in the country andn-1n−1undirected underwater roads which connect all cities.In order to save en...原创 2019-09-15 23:48:21 · 210 阅读 · 0 评论 -
牛客上偷到的全局最小割板子
namespace global_mincut{#define INT_MAX 0x3f3f3f3f int mp[502][502]; int N; bool combine[502]; int minC=INT_MAX; void init(int n){ memset(mp, 0, sizeof(mp)); N = ...原创 2019-10-04 19:01:52 · 196 阅读 · 0 评论 -
2019 ICPC南昌邀请赛比赛 J Distance on the tree(树链剖分上建可持续化线段树)
DSM(Data Structure Master) once learned about tree when he was preparing for NOIP(National Olympiad in Informatics in Provinces) in Senior High School. So when in Data Structure Class in College, he i...原创 2019-04-22 21:16:21 · 1135 阅读 · 2 评论 -
POJ - 3177 Redundant Paths (边双连通||无向图缩点)
In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1..F) to another field, Bessie and the rest of the herd are forced to cross near the Tree of Rotten Apples....原创 2019-04-15 21:55:03 · 208 阅读 · 0 评论 -
山东省第二届aThe Largest SCC(强连通分量)
The Largest SCC 1000 ms65536 KiB ...原创 2019-03-26 20:30:52 · 196 阅读 · 0 评论 -
ICPC2018南京网络赛 Magical Girl Haze(分层图+优先队列优化spfa)
There are NN cities in the country, and MMdirectional roads from uu to v(1\le u, v\le n)v(1≤u,v≤n). Every road has a distance c_ici. Haze is a Magical Girl that lives in City 11, she can choose no mo...原创 2018-09-02 21:11:55 · 303 阅读 · 0 评论 -
HDU - 5876 Sparse Graph (关于补图中求某点到各个点最短路)
Sparse Graph Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 2830 Accepted Submission(s): 972 Problem Description In...原创 2018-10-01 23:06:22 · 171 阅读 · 0 评论