Test instructions
In a three-dimensional space, the shortest time from the starting point to the end is spent.
where n holes, the time spent in the hole is 0, the time spent outside the hole is 10sec per unit
Ideas:
Water problem
Establish the starting point to the sides of each hole, establish the end point to the side of each hole, establish the starting point to the end of the edge, and the edge is the time spent to reach the desired point. To find the shortest possible time.
Code
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <vector > #include <queue>using namespace std;const int maxn = 105;int n;struct ball{double x, y, Z, R; Ball () {} ball (double x_, double y_, double z_, double r_) {x = X_; y = y_; z = z_; }}BB[MAXN];d ouble sx,sy,sz,ex,ey,ez;const int INF = 0x3f3f3f3f;const int maxnode = 110;struct edge{int u, v; Double Dist; Edge () {} edge (int u, int v, double dist) {this->u = u; This->v = v; This->dist = dist; }};struct Heapnode {int u; Double D; Heapnode () {} heapnode (double D, int u) {this->d = D; This->u = u; } BOOL operator < (const heapnode& c) Const {return d > c.d; }};struct Dijkstra {int n, m; Vector<edge> edges; Vector<int> G[maxnode]; BOOL Done[maxnode]; Double D[maxnode]; int P[maxnode]; void init (int tot) { n = tot; for (int i = 0; i < n; i++) g[i].clear (); Edges.clear (); } void Add_edge (int u, int v, double dist) {Edges.push_back (Edge (U, V, dist)); m = Edges.size (); G[u].push_back (m-1); } void Dijkstra (int s) {priority_queue