How to write code to achieve bouquet effect
This article mainly explains "how to write code to achieve the bouquet effect". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn "how to write code to achieve the bouquet effect"!
General definition of BFS: queue Q [], multiplicity array st []
# include#include#include#include#include#define x first#define y secondusing namespace std;const int Nong210 bot typedef pair PII;int T; / T group data int dist [N] [N]; / / Multiplicative array char g [N] [N]; / / Storage maze int nMint bfs (PII start,PII end) {queue q; memset (dist,-1,sizeof dist); dist [start.x] [start.y] = 0; q.push (start) Int dx [4] = {- 1scorecy 1score0}, dy [4] = {0flore 1way1}; while (q.size ()) {/ / automatically infer the type auto t=q.front (); / / depart q.pop (); for (int ionome0ash I > T; while (T lym -) {cin > n > > m; for (int ionomy 0transf I < n) PII start,end; for +) {scanf ("% s", & g [I]);} / / set the start and end point PII start,end; for (int iTuno