USACO Section 5.4 TeleCowmunication(最小割)

挺裸的一道最小割。把每台电脑拆成一条容量为1的边,然后就跑最大流。从小到大枚举每台电脑,假如去掉后 最大流=之前最大流+1,那这台电脑就是answer之一了。
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
Telecowmunication
Farmer John's cows like to keep in touch via email so they have created a network of cowputers so that they can intercowmunicate. These machines route email so that if there exists a sequence of c cowputers a1, a2, ..., a(c) such that a1 is connected to a2, a2 is connected to a3, and so on then a1 and a(c) can send email to one another.
Unfortunately, a cow will occasionally step on a cowputer or Farmer John will drive over it, and the machine will stop working. This means that the cowputer can no longer route email, so connections to and from that cowputer are no longer usable.
Two cows are pondering the minimum number of these accidents that can occur before they can no longer use their two favorite cowputers to send email to each other. Write a program to calculate this minimal value for them, and to calculate a set of machines that corresponds to this minimum.
For example the network:
1* / 3 - 2*
shows 3 cowputers connected with 2 lines. We want to send messages between 1 with 2. Direct lines connect 1-3 and 2-3. If cowputer 3 is down, them there is no way to get a message from 1 to 2.
PROGRAM NAME: telecow
INPUT FORMAT
| Line 1 | Four space-separated integers: N, M, c1, and c2. N is the number of computers (1 <= N <= 100), which are numbered 1..N. M is the number of connections between pairs of cowputers (1 <= M <= 600). The last two numbers, c1 and c2, are the id numbers of the cowputers that the questioning cows are using. Each connection is unique and bidirectional (if c1 is connected to c2, then c2 is connected to c1). There can be at most one wire between any two given cowputers. Computer c1 and c2 will not have a direction connection. |
| Lines 2..M+1 | The subsequent M lines contain pairs of cowputers id numbers that have connections between them. |
SAMPLE INPUT (file telecow.in)
3 2 1 2 1 3 2 3
OUTPUT FORMAT
Generate two lines of output. The first line is the minimum number of cowputers that can be down before terminals c1 & c2 are no longer connected. The second line is a minimal-length sorted list of cowputers that will cause c1 & c2 to no longer be connected. Note that neither c1 nor c2 can go down. In case of ties, the program should output the set of computers that, if interpreted as a base N number, is the smallest one.
SAMPLE OUTPUT (file telecow.out)
1 3
USACO Section 5.4 TeleCowmunication(最小割)的更多相关文章
- LG1345 「USACO5.4」Telecowmunication 最小割
问题描述 LG1345 题解 点边转化,最小割,完事. \(\mathrm{Code}\) #include<bits/stdc++.h> using namespace std; tem ...
- [USACO5.4]奶牛的电信Telecowmunication 最小割
题目描述 农夫约翰的奶牛们喜欢通过电邮保持联系,于是她们建立了一个奶牛电脑网络,以便互相交流.这些机器用如下的方式发送电邮:如果存在一个由c台电脑组成的序列a1,a2,...,a(c),且a1与a2相 ...
- [Luogu P1345] [USACO5.4]奶牛的电信Telecowmunication (最小割)
题面 传送门:https://www.luogu.org/problemnew/show/P1345 ] Solution 这道题,需要一个小技巧了解决. 我相信很多像我这样接蒟蒻,看到这道题,不禁兴 ...
- [USACO Section 4.4]追查坏牛奶Pollutant Control (最小割)
题目链接 Solution 一眼看过去就是最小割,但是要求割边最少的最小的割. 所以要用骚操作... 建边的时候每条边权 \(w = w * (E+1) + 1;\) 那么这样建图跑出来的 \(max ...
- 洛谷P1345 [USACO5.4]奶牛的电信Telecowmunication【最小割】分析+题解代码
洛谷P1345 [USACO5.4]奶牛的电信Telecowmunication[最小割]分析+题解代码 题目描述 农夫约翰的奶牛们喜欢通过电邮保持联系,于是她们建立了一个奶牛电脑网络,以便互相交流. ...
- USACO 4.4.2 追查坏牛奶 oj1341 网络流最小割问题
描述 Description 你第一天接手三鹿牛奶公司就发生了一件倒霉的事情:公司不小心发送了一批有三聚氰胺的牛奶.很不幸,你发现这件事的时候,有三聚氰胺的牛奶已经进入了送货网.这个送货网很大,而且关 ...
- USACO 4.4 Pollutant Control (网络流求最小割割集)
Pollutant ControlHal Burch It's your first day in Quality Control at Merry Milk Makers, and already ...
- 洛谷P1345 [USACO5.4]奶牛的电信Telecowmunication(最小割)
题目描述 农夫约翰的奶牛们喜欢通过电邮保持联系,于是她们建立了一个奶牛电脑网络,以便互相交流.这些机器用如下的方式发送电邮:如果存在一个由c台电脑组成的序列a1,a2,...,a(c),且a1与a2相 ...
- P1345 [USACO5.4]奶牛的电信Telecowmunication【最小割】【最大流】
题目描述 农夫约翰的奶牛们喜欢通过电邮保持联系,于是她们建立了一个奶牛电脑网络,以便互相交流.这些机器用如下的方式发送电邮:如果存在一个由c台电脑组成的序列a1,a2,...,a(c),且a1与a2相 ...
随机推荐
- Protection 5 ---- Priviliege Level Checking 2
CPU不仅仅在程序访问数据段和堆栈段的时候进行权限级别检查,当程序控制权转换的时候也会进行权限级别检查.程序控制权转换的情况很多,各种情况下检查的方式以及涉及到的检查项都是不同的.这篇文章主要描述了各 ...
- 【转】stdin, stdout, stderr 以及重定向
详细见: http://my.oschina.net/qihh/blog/55308 stdin是标准输入文件,stdout是标准输出文件,stderr标准出错文件. 程序按如下方式使用这些文件: 标 ...
- mysql 5.6密码强度插件使用
在mysql 5.6对密码的强度进行了加强,推出了validate_password 插件.支持密码的强度要求. 此插件要求版本:5.6.6 以上版本安装方式: 1.安装插件:(默认安装了插件后,强度 ...
- 利用虚拟光驱实现 将WINDOWS文件供虚拟机中的UBUNTU共享
此方法只能实现(至少目前我发现只能这样)将文件传递给虚拟机中的ubuntu 中,供ubuntu系统阅读,拷贝等,但不能将ubuntu中的数据传递给windows. 即:每次更新windows的数据到u ...
- bit-map牛刀小试:数组test[X]的值所有在区间[1, 8000]中, 现要输出test中反复的数。要求:1. 不能改变原数组; 2.时间复杂度为O(X);3.除test外空间不超过1KB
先来看看这个题目:数组test[X]的值所有在区间[1, 8000]中. 现要输出test中反复的数.要求:1. 不能改变原数组; 2.时间复杂度为O(X);3.除test外空间不超过1KB. 好, ...
- 关于"cin>>"输入成功或失败时的“返回值”(转载)
今天在看c++primer的时候,读到其中这样一段话: When we use an istream as a condition, the effect is to test the state o ...
- STL模板_概念
模板和STL一.模板的背景知识1.针对不同的类型定义不同函数版本.2.借助参数宏摆脱类型的限制,同时也因为失去的类型检查而引 入风险.3.借助于编译预处理器根据函数宏框架,扩展为针对不同类型的 具体函 ...
- 一周学会Mootools 1.4中文教程:(1)Dom选择器
利器: 君欲善其事须先利其器,好吧因为我们的时间比较紧迫,只有六天而已,那么六天的时间用死记硬背的方式学会Mt犹如天方夜谭,因此我们需要借鉴一下Editplus的素材栏帮我们记忆就好了,当我们需要用到 ...
- 0622 python 基础05
使用双重for循环,打印 0~100 # -*- coding: utf-8 -*- # D:\python\test.py def printOneToHundred(): for i in ...
- Java I/O theory in system level
参考文章: JAVA NIO之浅谈内存映射文件原理与DirectMemory Java NIO 2.0 : Memory-Mapped Files | MappedByteBuffer Tutoria ...