DJ and Mark are very lazy guys. These are not the guys from some game, these are the ones playing games all the time. Recently, they bought a new game named "Graph Vertices chooser". The rules of this game are pretty simple. It's a two-player game with each player taking alternating turns starting with DJ. You are given a weighed graph. All the vertices are initially unmarked. In each turn, a player chooses an unmarked vertex and mark it to red or black colour (DJ marks red whereas Mark marks black). The game ends when there is no any unmarked vertex left. After the end of the game, DJ's score will be weight of all the edges in graph such that both the end points of the edge are coloured red. Similarly, score of Mark is sum of weight of edges with both end points being black. DJ would like to maximize difference between his and Mark points, while Mark would like to minimize the difference between DJ's and his score. Both players optimally. Now, you are the one who decided to be the coach of both the players. You want to create many graphs for DJ and Mark to train. For that, you decided to take a graph H of N vertices. Initially, there is no edge in graph H. One by one, you will add an edge in the graph H and ask the both the players to play on the newly created graph. You will add M such edges. For each of the M graphs, you have to tell the difference between points of DJ and Mark at the end of the game, when they play the game on that graph. Note that self-loops and multi-edges are allowed to exist. Develop C++ develop code for the problem. Input: 1 54 121 131 141 151 Output: 1 1

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

computer engineering course: CSE102

DJ and Mark are very lazy guys. These are not the guys from some game, these
are the ones playing games all the time. Recently, they bought a new game
named "Graph Vertices chooser".
The rules of this game are pretty simple. It's a two-player game with each player
taking alternating turns starting with DJ. You are given a weighed graph. All
the vertices are initially unmarked. In each turn, a player chooses an unmarked
vertex and mark it to red or black colour (DJ marks red whereas Mark marks
black). The game ends when there is no any unmarked vertex left. After the end
of the game, DJ's score will be weight of all the edges in graph such that both the
end points of the edge are coloured red. Similarly, score of Mark is sum of weight
of edges with both end points being black.
DJ would like to maximize difference between his and Mark points, while Mark
would like to minimize the difference between DJ's and his score. Both players
optimally.
Now, you are the one who decided to be the coach of both the players. You want
to create many graphs for DJ and Mark to train. For that, you decided to take a
graph H of N vertices. Initially, there is no edge in graph H. One by one, you will
add an edge in the graph H and ask the both the players to play on the newly
created graph. You will add M such edges. For each of the M graphs, you have to
tell the difference between points of DJ and Mark at the end of the game, when
they play the game on that graph. Note that self-loops and multi-edges are
allowed to exist. Develop C++ develop code for the problem.
Input:
1
54
121
131
141
151
Output:
1
1
Transcribed Image Text:DJ and Mark are very lazy guys. These are not the guys from some game, these are the ones playing games all the time. Recently, they bought a new game named "Graph Vertices chooser". The rules of this game are pretty simple. It's a two-player game with each player taking alternating turns starting with DJ. You are given a weighed graph. All the vertices are initially unmarked. In each turn, a player chooses an unmarked vertex and mark it to red or black colour (DJ marks red whereas Mark marks black). The game ends when there is no any unmarked vertex left. After the end of the game, DJ's score will be weight of all the edges in graph such that both the end points of the edge are coloured red. Similarly, score of Mark is sum of weight of edges with both end points being black. DJ would like to maximize difference between his and Mark points, while Mark would like to minimize the difference between DJ's and his score. Both players optimally. Now, you are the one who decided to be the coach of both the players. You want to create many graphs for DJ and Mark to train. For that, you decided to take a graph H of N vertices. Initially, there is no edge in graph H. One by one, you will add an edge in the graph H and ask the both the players to play on the newly created graph. You will add M such edges. For each of the M graphs, you have to tell the difference between points of DJ and Mark at the end of the game, when they play the game on that graph. Note that self-loops and multi-edges are allowed to exist. Develop C++ develop code for the problem. Input: 1 54 121 131 141 151 Output: 1 1
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY