uva753 A Plug for UNIX】的更多相关文章

C - A Plug for UNIX    You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet as cumb…
解题报告 题意: n个插头m个设备k种转换器.求有多少设备无法插入. 思路: 定义源点和汇点,源点和设备相连,容量为1. 汇点和插头相连,容量也为1. 插头和设备相连,容量也为1. 可转换插头相连,容量也为inf(由于插头有无限个) #include <map> #include <queue> #include <cstdio> #include <vector> #include <cstring> #include <iostream…
最大流. 流可以对应一种分配方式. 显然最大流就可以表示最多匹配数 #include<cstdio> #include<algorithm> #include<cstring> using namespace std; + ; + ; ; const int inf = 0x3f3f3f3f; char s[maxn][maxl],t[maxl],t2[maxl]; int g[maxn],v[maxm],nex[maxm],f[maxm],eid; int id[ma…
A Plug for UNIX   Description You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet…
POJ 1087 A Plug for UNIX / HDU 1526 A Plug for UNIX / ZOJ 1157 A Plug for UNIX / UVA 753 A Plug for UNIX / UVAlive 5418 A Plug for UNIX / SCU 1671 A Plug for UNIX (网络流) Description You are in charge of setting up the press room for the inaugural meet…
A Plug for UNIX You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet as cumbersome…
A Plug for UNIX Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14786 Accepted: 4994 Description You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an interna…
                                   A Plug for UNIX Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16083   Accepted: 5513 Description You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet…
C - A Plug for UNIXTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88038#problem/C Description You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet…
  A Plug for UNIX  You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet as cumberso…
A Plug for UNIX Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13855   Accepted: 4635 Description You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an int…
A Plug for UNIX Description You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet as…
A Plug for UNIX 题目链接:https://vjudge.net/problem/POJ-1087 Description: You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow o…
题目链接:https://vjudge.net/problem/POJ-1087 A Plug for UNIX Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 17861   Accepted: 6172 Description You are in charge of setting up the press room for the inaugural meeting of the United Nations In…
A Plug for UNIX Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged on PKU. Original ID: 108764-bit integer IO format: %lld      Java class name: Main     You are in charge of setting up the press room for the inaugural meeting of th…
A Plug for UNIX Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14862   Accepted: 5026 Description You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an int…
题意:给定n个插座,m个插头,k个转换器(x,y),转换器可以让插头x转成插头y.问最少有多少个插头被剩下. 题解: 最大流或者二分图匹配.然而我不知道怎么打二分图匹配..打了最大流.这题字符串比较坑爹,我就先把所有字符串编号(去重),然后给每个点编两个号,一个代表它作为插头的编号,一个代表它作为插座的编号.最坑的是uvaWA了好久最后发现结尾要有一个回车..... 还有数据范围也是个坑点,点起码要开500. 代码如下:(poj上是单组数据,uva和hdu都是多组) #include<cstdi…
题意:给定一些插座和一些插头,还有一些单向接头,比如A->B 接头可以串联A->B->C->D 使得插座和插头匹配数目最大 题解: 首先接头可以用Floyd处理 这题可以转化为二分图的模型,就是直接连边,不做处理 #include<cstdio> #include<cstdlib> #include<algorithm> #include<cstring> #include<map> #include<iostrea…
题面 You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet as cumbersome and bureaucra…
描述 You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet as cumbersome and bureaucra…
题目描述 Description You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet as cumbersome…
Description You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet as cumbersome and…
You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet as cumbersome and bureaucratic…
http://poj.org/problem?id=1087 好久没遇见过这么坑的题了这个题真是挫的够可以的.题目大意:你作为某高管去住宿了,然后宾馆里有几种插座,分别有其对应型号,你携带了几种用电器(手机,电脑一类的), 也有其对应型号:可是不一定用电器就能和插座匹配上,于是宾馆的商店里提供了一些转换器,这些转换器可以将某一型号电源转换成另一型号的.问,你的用电器最少会有多少种无 法充电.也就是问可以用上电的用电器的最大数目,之后用电器总数减去此可用电最大数目即可得到最小不能用电数目. 一开始…
题意: 给n个插座,m个设备(肯定要插电了),k种转换头可无限次使用(注意是单向的),问有多少设备最终是不能够插上插座的? 分析: 看起来就是设备匹配插座,所以答案不超过m.这个题适合用网络流来解. 假设每种头对应着一个编号(可以用map实现转换string到int),主要在k种转换头的建边,他们之间的转换关系就是编号与编号之间的边,因为可以无限次使用,所以容量无穷.再添加源点和汇点就建完了,汇点连接每个插座,源点连接每个设备,每边容量为1.使用增广路算法就得出解了.注意要空一行. 很不愿意用结…
题目描述:现在由你负责布置Internet联合组织首席执行官就职新闻发布会的会议室.由于会议室修建时被设计成容纳全世界各地的新闻记者,因此会议室提供了多种电源插座用以满足(会议室修建时期)各国不同插头的类型和电压.不幸的是,会议室是很多年前修建的,那时新闻记者很少使用电子设备,所以会议室对每种插座只提供了一个.新闻发布会时,新闻记者需要使用许多电子设备,如手提电脑,麦克风,录音机,传呼机等等.尽管这些设备很多可以使用电池,但是由于发布会时间很长并且是单调乏味的,记者们希望能够使用尽可能多的设备(…
题意: 有n个插座,m个设备以及k种转化器(每种转化器视为有无限个). 转换器A->B可以将A类型的插头转化成B类型的插头,所以可以插在B类型的插座上. 求最少剩多少不匹配的设备. 分析: 抛开转换器不讲,插头插在插座上就是一个最大二分图匹配. 可以用最大流的算法,增加一个连接每个插头的源点s和连接每个插座的汇点t,每条弧容量都为1. 然后求最大流量,就是二分图的最大基数匹配. 既然有了转换器,一种插头可以用转换器转换成多种类型的插头,所以可以Floyd一次,求出每种插头可以转换成的所有的插头类…
读题比做题难系列…… poj1087 输入n,代表插座个数,接下来分别输入n个插座,字母表示.把插座看做最大流源点,连接到一个点做最大源点,流量为1. 输入m,代表电器个数,接下来分别输入m个电器,字符串表示.把电器看做最大流终点,连接到一个点做最大汇点,流量为1. 输入k,代表转换器个数,接下来分别输入k个转换器,每个插座输入两个字母a,b表示a可以连在b上.把转换器看做流,b->a,因为转换器无限提供,流量为无限大 代码: #include <iostream> #include &…
网络流,关键在建图 建图思路在代码里 /* 最大流SAP 邻接表 思路:基本源于FF方法,给每个顶点设定层次标号,和允许弧. 优化: 1.当前弧优化(重要). 1.每找到以条增广路回退到断点(常数优化). 2.层次出现断层,无法得到新流(重要). 时间复杂度(m*n^2) */ #include <iostream> #include <cstdio> #include <cstring> #include <map> #define ms(a,b) mem…
题目大意:这个题意有些蛋疼,看了很大会才明白什么意思,有N个插座,这些插座都是有类型的只能给这种类型的电器充电,下面接着给了M种电器,和电器的插头类型,还有K种转换器,可以把一种类型转换成另一种,转换器也是可以串联使用的. 输入说明: 首先输入的是一个N,下面有N种插座,每种插座都有一个字符串代表,接着输入一个M,表示有M个电器需要充电,输入的每行有一个电器和它需要的插座类型,然后输入一个K,下面有K个转换器. 分析:这个英文写的这么长确实比较难理解,不过看懂题意后也是比较容易了,可以让电器给可…