编程介的小学生 2020-02-23 21:30 采纳率: 20.5%
浏览 143

Perfect matching 匹配的问题

Problem Description
Given the complete bipartite graph. Each part of this graph has N vertices, i.e. the graph is balanced. An integer number (called a weight) assigns to each vertex. The weight of the edge is defined as the product of weights of vertices which connected by this edge.
It is well known, a matching in a graph is a set of edges without common vertices. A matching is perfect, if it covers all vertices of a graph.
Write a program to find a perfect match of the given bipartite graph with the maximal weight of the matching edges minimal.

Input
The input consists of multiple cases.
For each testcase,there will be exactly three lines;
The first line contains one integer number N (1 ≤ N ≤ 105). The second line consist of N integer numbers, not exceeded 109 by absolute value. The i-th number in line denotes a weight of i-th vertex of first part of a graph. In the third line, weights of vertices of second part are presented.

Output
The answer specified above.

Sample Input
3
1 2 3
9 10 11

Sample Output
27

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog