算法
The stroke
这个作者很懒,什么都没留下…
展开
-
匈牙利算法(简单易懂)
matrix67(点击打开链接):说穿了,就是你从二分图中找出一条路径来,让路径的起点和终点都是还没有匹配过的点,并且路径经过的连线是一条没被匹配、一条已经匹配过,再下一条又没匹配这样交替地出现。找到这样的路径后,显然路径里没被匹配的连线比已经匹配了的连线多一条,于是修改匹配图,把路径里所有匹配过的连线去掉匹配关系,把没有匹配的连线变成匹配的,这样匹配数就比原来多1个。不断执行上述操作,直到找不到...转载 2018-02-26 18:00:00 · 504 阅读 · 1 评论 -
HDU 4280 Island Transport ISAP+bfs 初始化 + 栈优化
Island TransportTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 11917 Accepted Submission(s): 3802 Problem Description In the vast...原创 2018-08-20 21:23:33 · 189 阅读 · 0 评论 -
已知前序(先序)与中序输出后序
已知前序(先序)与中序输出后序:前序:1, 2, 3, 4, 5, 6(根左右)中序:3, 2, 4, 1, 6, 5(左根右)分析:因为前序(根左右)最先出现的总是根结点,所以令root为前序中当前的根结点下标(并且同时把一棵树分为左子树和右子树)。start为当前需要打印的子树在中序中的最左边的下标,end为当前需要打印的子树在中序中最右边的下标。递归打印这棵树的后序,递归出口为start &...原创 2018-07-20 21:03:33 · 1848 阅读 · 0 评论 -
Stars POJ - 2352 树状数组
Stars POJ - 2352 Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars tha...原创 2018-07-26 09:56:03 · 214 阅读 · 0 评论 -
Japan POJ - 3067 树状数组
Japan POJ - 3067 Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coas...原创 2018-07-26 09:54:39 · 129 阅读 · 0 评论 -
Just a Hook HDU - 1698 线段树区间更新
Just a Hook HDU - 1698 In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of th...原创 2018-07-26 09:49:40 · 155 阅读 · 0 评论 -
敌兵布阵 HDU--1166 线段树改变单点
敌兵布阵 HDU - 1166 C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 ...原创 2018-07-26 09:46:21 · 133 阅读 · 0 评论 -
最大生成树模板 POJ-2377
Bad CowtractorsBessie has been hired to build a cheap internet network among Farmer John's N (2 <= N <= 1,000) barns that are conveniently numbered 1..N. FJ has already done some surveying, a...原创 2018-07-19 10:25:25 · 150 阅读 · 0 评论 -
多重背包二进制优化
F : 安详概览问题列表状态排名Progress Bar时间限制:1 Sec 内存限制:256 MiB提交:280 答案正确:21提交 题目描述 spring最近喜欢上了B站新秀主播,身为顿顿吃黄焖鸡的土豪,当然要过去打赏一番,但是spring还是喜欢精打细算,所以在打赏的时候,想要掏出有限的钱,获得主播的最大好感。主播的好感值是通过送不同的礼物而提升不同...原创 2018-07-24 15:48:36 · 702 阅读 · 0 评论 -
spfa首发 POJ 3259
WormholesWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a ...原创 2018-07-18 21:15:23 · 119 阅读 · 0 评论 -
Dijkstra算法模板---单源最短路---邻接矩阵模板+题目 poj 3268 Silver Cow Party
Silver Cow PartyOne cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirec...原创 2018-07-18 14:17:42 · 272 阅读 · 0 评论 -
UVA 10480 Sabotage 最大流
UVA 10480 - Sabotage (最大流)SabotageThe regime of a small but wealthy dictatorship has been abruptly overthrown by an unexpected rebellion. Because of the enormous disturbances this is causing in...原创 2018-08-21 09:41:00 · 119 阅读 · 0 评论