Question: Question 3 The output contains 2 space - separated numbers, the first number being the maximum number of cities in the even cleaniiness cities marathon

Question 3 The output contains 2 space-separated
numbers, the first number being the
maximum number of cities in the even
cleaniiness cities marathon path, and the
second number being the maximum number
of cities in the odd cleantiness cities
marathon path
Input Format For Custom Testing
Sample Case 0
Sample Input For Custom Testing
Sample Output
23
Explanation
Marathon path with even cleanliness score
cities: 1,3(2 cities)
Marathon path with odd cleanliness score
cities: 4,2,5(3 cities)
#include kunordered_map>
using namespace std;
\checkmark int main(){
27 return 0; Output
The output contains 2 space-separated
numbers, the first number being the
maximum number of cities in the even
cleanliness cities marathon path, and the
second number being the maximum number
of cities in the odd cleantimess cities
marathon path
Input Format For Custom Testing
The first line contains n, the number of
cities.
The second line contains n integers A[1].
A[2].....A[n], denoting the cleanliness
score of each city.
Next n-1 lines contain two integers x and y,
denoting there is a road between city x and
city y.
Sample Case 0
Sample Input For Custom Testing
5
432235
12
13
2.4
25
There are n cities in a country numbered
from 1 to n.
These n cities are connected using n-1
bidirectional roads, such that it is possible to
go from any city to any other city using these
roads.
Each city has a cleanlliness score of its own
given by A[i].
Now two marathons need to be organized
for the Go Green campaign but the path of
the marathon must contain cities with either
only even clean/iness score or an odd
cleaniness score.
you can travel a road between 2 cities only
once in a marathon path.
You have to tell the maximum number of
cities included in the marathon path if the
cities were with even cleanliness score and if
int main(){
the cities were with odd cleanliness score.
Question 3 The output contains 2 space -

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!