12063 - DS_2018Fall_Homework4   

Description

In this homework, you need to implement the basic graph data structure and four commands.

addEdge

shortest path

minimum spanning tree 

two color

 

Input

Input starts with an integer n indicating the number of nodes in the graph, 0 <= n<= 2500. Then, a set of m edges, 0<= m<=950000, and k command, 0<=0k<=30, are given. The following four commands might appear multiple times (even interleaving) add, shortest_path, mst_weight, two_colorable.

Output

Print the outputs of the given commands.

Sample Input  Download

Sample Output  Download

Partial Judge Code

12063.cpp

Partial Judge Header

12063.h

Tags




Discuss