zoukankan      html  css  js  c++  java
  • 1272. Non-Yekaterinburg Subway

    A little town started to construct a subway. The peculiarity of the town is that it is located on small islands, some of them are connected with tunnels or bridges. The mayor is sure that the subway is to be under the ground, that’s why the project must use the less bridges the better. The only request for the subway is that the townsmen could get by metro (may be with changes) from every island to every island. Fortunately, we know that there is enough tunnels and bridges for it. It was decided to construct as less passages from island to island as possible to save money.
    Your task given a town plan to determine the minimal possible number of bridges that is necessary to use in the subway construction.

    Input

    The first line contains three integers separated with a space: N (the number of islands,1 ≤ N ≤ 10000), K (the number of tunnels, 0 ≤ K ≤ 12000) and M (the number of bridges,0 ≤ M ≤ 12000). Then there are K lines; each line consists of two integers — the numbers of islands, connected with the corresponding tunnel. The last M lines define bridges in the same format.

    Output

    the minimal number of bridges necessary for the subway construction.

    Sample

    inputoutput
    6 3 4
    1 2
    2 3
    4 5
    1 3
    3 4
    4 6
    5 6
    2
    Problem Author: Magaz Asanov (prepared Igor Goldberg) Problem Source: Ural State University championship, October 25, 2003
  • 相关阅读:
    Nginx的状态统计、目录保护、访问控制
    nginx如何解析php?
    CentOS6 搭建LNMP环境
    nginx的工作原理和工作模式
    shell脚本--逐行读取文件内容
    nginx配置文件中的的逻辑关系
    SecureCRT 拷贝时弹出 "Could not open clipboard: Assess is denied"
    Markdown的超链接由新窗口打开
    nginx查找模块、配置指令
    nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
  • 原文地址:https://www.cnblogs.com/sdau--codeants/p/3242079.html
Copyright © 2011-2022 走看看