
图 论
文章平均质量分 79
图 论
「已注销」
这个作者很懒,什么都没留下…
展开
-
D - Book Club Gym - 100783D 最大流Dinic
题意:在一个借书会中,若A喜欢B的书,B喜欢C的书,C喜欢A的书这样每个人都可以借到书了,输出 yes若 A喜欢B的书,B喜欢C的书,C喜欢D的书这样就不能保证每个人都借到书,输出 no题解:最大流这个可以看做二分匹配,将每一个点拆分为两个点A B,自己与自己不连边添加一个源点和一个汇点,源点到A的流的大小为 1 B到汇点的流的大小原创 2017-06-07 19:21:21 · 832 阅读 · 0 评论 -
拓扑排序入门
输入:先输入n,m表示点数,边数然后输入有向边 u v(从u指向v)输出:如果有环输出Network has a cycle!没有环就输出拓扑序列输入样例:6 81 21 42 63 23 65 15 25 66 81 31 22 53 44 24 65 45 60 0输出样例:5 1 4原创 2017-03-01 15:34:17 · 308 阅读 · 0 评论 -
poj1459 最大流之一般预流推进算法
Power NetworkTime Limit: 2000MS Memory Limit: 32768KTotal Submissions: 27505 Accepted: 14294DescriptionA power network consists of nodes (power stations, consum原创 2016-11-08 11:14:15 · 1328 阅读 · 0 评论 -
poj 2112 最大流之Dinic算法+Floyd
Optimal MilkingTime Limit: 2000MS Memory Limit: 30000KTotal Submissions: 16747 Accepted: 6017Case Time Limit: 1000MSDescriptionFJ has moved his K (1 <= K原创 2016-11-06 15:59:22 · 402 阅读 · 0 评论 -
poj 1273 最大流之最短路径增广法(EK)
Drainage DitchesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 71182 Accepted: 27694DescriptionEvery time it rains on Farmer John's fields, a pond fo原创 2016-10-25 22:17:09 · 976 阅读 · 0 评论 -
poj 1149 最大流之Ford Fulkerson算法
PIGSTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 20394 Accepted: 9309DescriptionMirko works on a pig farm that consists of M locked pig-houses and原创 2016-10-25 17:23:18 · 449 阅读 · 0 评论 -
poj 1780 欧拉回路求解
CodeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2520 Accepted: 881DescriptionKEY Inc., the leading company in security hardware, has developed a n原创 2016-10-23 15:28:16 · 561 阅读 · 0 评论 -
poj 2513 欧拉回路+并查集+字典树
Colored SticksTime Limit: 5000MS Memory Limit: 128000KTotal Submissions: 35912 Accepted: 9388DescriptionYou are given a bunch of wooden sticks. Each endpoint of原创 2016-10-21 20:02:36 · 372 阅读 · 0 评论 -
poj 1386 并查集+有向欧拉通路
Play on WordsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 11890 Accepted: 4061DescriptionSome of the secret doors contain a very interesting word p原创 2016-10-20 14:06:12 · 362 阅读 · 0 评论 -
poj 1300 欧拉回路判定方法
Door ManTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2653 Accepted: 1082DescriptionYou are a butler in a large mansion. This mansion has so many ro原创 2016-10-14 15:23:18 · 494 阅读 · 0 评论 -
poj 1556 计算几何(判断线段相交+建图)+最短路
The DoorsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 8779 Accepted: 3369DescriptionYou are to find the length of the shortest path through a chamber原创 2017-07-19 15:53:50 · 458 阅读 · 0 评论 -
B - Flowery Trails Gym - 100783B 堆优化最短路 单源到各个点最短路
题意:计算 1 和 n 两点间最短路的路径和的两倍题解:1 计算最短路2 枚举没一条边到两端的距离加上本身长度,判断是等于最短路长度3 若是的,那么这条边可以当做最短路的一条边下面是堆优化最短路(源点到各个点的最短路):#include#include#include#include#includeusing nam原创 2017-06-07 18:56:20 · 614 阅读 · 0 评论 -
poj 1502 Dijkstra
MPI MaelstromTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 8382 Accepted: 5144DescriptionBIT has recently taken delivery of their new supercomputer,原创 2016-08-08 11:12:58 · 302 阅读 · 0 评论 -
poj 2502 Dijkstra
SubwayTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8667 Accepted: 2801DescriptionYou have just moved from a quiet Waterloo neighbourhood to a big,原创 2016-08-08 10:13:32 · 589 阅读 · 0 评论 -
poj 3026 BFS + prim(最短路最小生成树的区别)
Borg MazeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 12909 Accepted: 4206DescriptionThe Borg is an immensely powerful race of enhanced humanoids fro原创 2016-08-07 13:10:36 · 605 阅读 · 0 评论 -
poj 1122 dijkstra+记录路径
FDNY to the Rescue!Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2881 Accepted: 884DescriptionThe Fire Department of New York (FDNY) has always been p原创 2016-08-06 17:54:37 · 441 阅读 · 0 评论 -
poj 1511 SPFA
Invitation CardsTime Limit: 8000MS Memory Limit: 262144KTotal Submissions: 25057 Accepted: 8273DescriptionIn the age of television, not many people attend theater原创 2016-08-06 15:20:03 · 634 阅读 · 0 评论 -
poj 3169 差分约束
LayoutTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10068 Accepted: 4840DescriptionLike everyone else, cows like to stand close to their friends when原创 2016-08-05 15:43:06 · 296 阅读 · 0 评论 -
poj 1364 差分约束 SPFA(栈/队列)
KingTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 12169 Accepted: 4429DescriptionOnce, in one kingdom, there was a queen and that queen was expecting原创 2016-08-05 11:14:22 · 538 阅读 · 0 评论 -
poj 3159 差分约束 + SPFA + 栈
CandiesTime Limit: 1500MS Memory Limit: 131072KTotal Submissions: 28656 Accepted: 7913DescriptionDuring the kindergarten days, flymouse was the monitor of his c原创 2016-08-05 09:31:13 · 350 阅读 · 0 评论 -
poj 2983 差分路径+SPFA
Is the Information Reliable?Time Limit: 3000MS Memory Limit: 131072KTotal Submissions: 12669 Accepted: 3984DescriptionThe galaxy war between the Empire Draco an原创 2016-08-04 21:01:15 · 514 阅读 · 0 评论 -
poj 1716 poj 1201 差分约束+SPFA
Integer IntervalsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 13980 Accepted: 5940DescriptionAn integer interval [a,b], a < b, is a set of all consec原创 2016-08-04 14:59:47 · 412 阅读 · 0 评论 -
poj 2570 floyd 二进制+位运算
Fiber NetworkTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3536 Accepted: 1616DescriptionSeveral startup companies have decided to build a better Inte原创 2016-08-03 21:26:45 · 435 阅读 · 0 评论 -
poj 2263 floyd+map
Heavy CargoTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4060 Accepted: 2158DescriptionBig Johnsson Trucks Inc. is a company specialized in manufactur原创 2016-08-03 20:37:24 · 371 阅读 · 0 评论 -
poj 2240 map+floyd
ArbitrageTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 20573 Accepted: 8766DescriptionArbitrage is the use of discrepancies in currency exchange rates原创 2016-08-03 17:52:02 · 365 阅读 · 0 评论 -
poj 1797 并查集 / floyd(超时)
Heavy TransportationTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 29437 Accepted: 7865DescriptionBackground Hugo Heavy is happy. After the breakdown原创 2016-08-03 17:01:39 · 587 阅读 · 0 评论 -
poj 1125 Floyd
Stockbroker GrapevineTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 33870 Accepted: 18721DescriptionStockbrokers are known to overreact to rumours. You原创 2016-08-03 15:31:31 · 340 阅读 · 0 评论 -
poj 3268 SPFA
Silver Cow PartyTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 18421 Accepted: 8434DescriptionOne cow from each of N farms (1 ≤ N ≤ 1000) convenientl原创 2016-08-03 10:37:33 · 413 阅读 · 0 评论 -
poj 1860 Bellman-ford 逆向思维
Currency ExchangeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 26452 Accepted: 9777DescriptionSeveral currency exchange points are working in our ci原创 2016-08-02 15:21:34 · 350 阅读 · 0 评论 -
poj 3259 Bellman-ford + SPFA
WormholesTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 43809 Accepted: 16085DescriptionWhile exploring his many farms, Farmer John has discovered a转载 2016-08-02 11:35:33 · 437 阅读 · 0 评论 -
poj 1751 prim输出路径
HighwaysTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 13124 Accepted: 3786 Special JudgeDescriptionThe island nation of Flatopia is perfectly fl原创 2016-07-29 17:35:20 · 593 阅读 · 0 评论 -
poj 1251 prim or kruskal
Jungle RoadsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 23774 Accepted: 11149DescriptionThe Head Elder of the tropical island of Lagrishan has原创 2016-07-29 15:35:06 · 465 阅读 · 0 评论 -
poj 2387 Dijkstra入门(动态图解)
Til the Cows Come HomeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 43861 Accepted: 14902DescriptionBessie is out in the field and wants to get back转载 2016-07-28 15:24:12 · 2278 阅读 · 0 评论 -
全排列递归(搜索)以及库函数的应用 递归例题poj1731
#includevoid swapp(int a[],int i,int j){ printf("%d %d###\n",a[i],a[j]); int temp=a[i]; a[i]=a[j]; a[j]=temp; printf("%d %d###\n",a[i],a[j]);}void perm(int a[],int k,int m){ if(k==m) { for(int i=0;i原创 2016-02-01 00:11:04 · 618 阅读 · 0 评论 -
poj 2083 poj3768 画图搜索
这里是discuss里面的精简代码,不是用递归的代码#include"stdio.h"#include"math.h"main(){ int i,j,n,ii,jj,k; while(scanf("%d",&n)&&n--!=-1) { for(i=0;i for(j=0;j { for(ii=i,jj=j,k=0;k ; printf("%c",32+56*(k==原创 2016-02-01 00:11:17 · 666 阅读 · 0 评论 -
poj 2247 1338指针的滞后性
#include#define MIN(a,b) ((a>b)? (b):(a)) //宏定义函数const int MAIX=5850;int main(){ int n; int v1,v2,v3,v4; int p1,p2,p3,p4; int a[MAIX]; a[1]=1; p1=p2=p3=p4=1; for(int i=2;i { v1=a[p1]*2; v2=a[p2]*原创 2016-02-01 00:10:46 · 516 阅读 · 0 评论 -
poj 3620 简单深搜 连通分量
题目意思很简单:就是给定一个横向为N,纵向为M的田园,由于灾难有K个点形成了水池,问这些点组成最大的水池中包含有多少个小水池点这题目对应的知识点是:连通分量刚开始时候我自己写的代码没有注意到可以是环状的,导致有错误于是借鉴别人代码改进了一些,并且深入理解了连通分量的精髓了#include#include#includeusing namespace std;原创 2016-04-13 20:54:29 · 1125 阅读 · 0 评论 -
poj1664 经典深搜
Description把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。Input第一行是测试数据的数目t(0 Output对输入的每组数据M和N,用一行输出相应的K。Sample Input17 3Sample Output8#include原创 2016-04-13 19:06:04 · 500 阅读 · 0 评论 -
poj 2386 poj1562 poj1979 图的遍历 八个方向和四个方向 深搜
三个题基本上就是一样的思路,学到了怎么遍历四个方向和八个方向count初始化 poj1562#include#includeint w,h;char a[105][105];void mi_gong(int x,int y){ a[x][y]='*'; int tempx; int tempy; for(int k=-1;k1;k++) { for(in原创 2016-02-01 00:11:22 · 963 阅读 · 0 评论 -
poj1011 深搜入门
题目意思很简单:就是要把之前掰断的棍子还原成多少根一样长的棍子就好了#include#include#include#includeusing namespace std;int a[100];bool used[100];int aim,num,n;int cmp(int x,int y){ return (x>y?1:0);}bool dfs(int s原创 2016-03-16 21:21:58 · 756 阅读 · 0 评论