Lang:G++
Edit12345678910111213141516171819202122232425262728293031// ConsoleApplication1.cpp : Defines the entry point for the console application.//// #include "stdafx.h"#include <iostream>#include <fstream>#include <string>#include <vector>#include <queue>#include <set>#include <map>#include <stack>#include <utility>#include <algorithm>#include <numeric>#include <iomanip>#include <math.h>#include <string.h>using namespace std;const double PI = std::atan(1.0) * 4;const int MX = 550;int shortestLength[MX][MX];int b[MX];int a[MX];int n, m;queue<pair<int, int>> q;