Generation

translateTue, 02 May 2023

Purísima Systems is a company that provides Internet services through a set of antennas which are located in a two dimensional euclidean space. Although the antennas are of very good quality, they are not perfect and sometimes they fail. The company knows that each antenna can be connected to another with a physical cable directly, which allows the possibility of transmitting data from one antenna to another. This increases the quality of the service, in addition to providing a kind of backup functionality. Thus, the CEO of Purísima Systems, has decided to connect all the antennas with cables. Each antenna can be connected to only one antenna. Besides, there are two kind of antennas, white antennas and black antennas. Since the CEO of Purísima Systems is a very tidy person, she wants to connect only white antennas to black antennas (the amount of antennas per color is the same). Finally, since the cable for connecting antennas is very expensive, the company wants to save the maximum amount of cable used. That is, the company wants to know for the minimum necessary cable to connect all the antennas. Recently, Purísima Systems has hired you as a programmer. The CEO knows that you are the company's star programmer and she has asked you to write a computer program to solve this problem. Input A positive integer N , followed by 2N floating pairs X Y . The first N pairs represent the coordinates of the white antennas, and the last N pairs represent the coordinates of the black antennas. The coordinates are given in meters. The coordinates of the antennas are given in the range [0,300] .

#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; vector<double> white_antennas_x(n); vector<double> white_antennas_y(n); vector<double> black_antennas_x(n); vector<double> black_antennas_y(n); for(int i=0; i<n; i++){ cin>>white_antennas_x[i]>>white_antennas_y[i]; } for(int i=0; i<n; i++){ cin>>black_antennas_x[i]>>black_antennas_y[i]; } vector<vector<double> > distances(n); for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ distances[i].push_back(sqrt

Want to kickstart your project?Use the new AI Studio to create your code